@mapsindoors/map-template 1.0.0-rc.2 → 1.1.0
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 +3 -2
- package/package.json +7 -3
- package/dist/_commonjsHelpers-ba3f0406-b96e6d6a.mjs +0 -21
- package/dist/combo-box-item.entry-59124312.mjs +0 -14
- package/dist/combo-box-item.entry-8762d714.mjs +0 -12
- package/dist/combo-box-item.entry-92232c29.mjs +0 -12
- package/dist/combo-box-item.entry-f244c01a.mjs +0 -14
- package/dist/icon-b8d01d6f-ddfa2c17.mjs +0 -24
- package/dist/mapsindoors-react.es.js +0 -7
- package/dist/mapsindoors-react.umd.js +0 -1391
- package/dist/mapsindoors-webcomponent.es.js +0 -5
- package/dist/mapsindoors-webcomponent.umd.js +0 -1385
- package/dist/mi-card_2.entry-3de1663c.mjs +0 -25
- package/dist/mi-card_2.entry-508f65b2.mjs +0 -23
- package/dist/mi-card_2.entry-7dabf461.mjs +0 -23
- package/dist/mi-card_2.entry-d24478d0.mjs +0 -25
- package/dist/mi-chip.entry-74b3118c.mjs +0 -15
- package/dist/mi-chip.entry-8bfee95c.mjs +0 -13
- package/dist/mi-chip.entry-bcc6599b.mjs +0 -15
- package/dist/mi-chip.entry-d43333c8.mjs +0 -13
- package/dist/mi-column.entry-6a55a95f.mjs +0 -20
- package/dist/mi-column.entry-9b46d3b8.mjs +0 -18
- package/dist/mi-column.entry-f66623b9.mjs +0 -20
- package/dist/mi-column.entry-f901d5d1.mjs +0 -18
- package/dist/mi-combo-box.entry-0e6d9797.mjs +0 -262
- package/dist/mi-combo-box.entry-144ed7be.mjs +0 -260
- package/dist/mi-combo-box.entry-5cd60eff.mjs +0 -262
- package/dist/mi-combo-box.entry-69a04955.mjs +0 -260
- package/dist/mi-data-table.entry-0ace7eb1.mjs +0 -213
- package/dist/mi-data-table.entry-6cae08b0.mjs +0 -215
- package/dist/mi-data-table.entry-7fe09cbe.mjs +0 -213
- package/dist/mi-data-table.entry-ff1bd14d.mjs +0 -215
- package/dist/mi-distance_2.entry-02d887f0.mjs +0 -56
- package/dist/mi-distance_2.entry-33e65994.mjs +0 -54
- package/dist/mi-distance_2.entry-dca308c3.mjs +0 -54
- package/dist/mi-distance_2.entry-dffb2e64.mjs +0 -56
- package/dist/mi-dropdown-item.entry-508c6605.mjs +0 -12
- package/dist/mi-dropdown-item.entry-aeae3cf1.mjs +0 -14
- package/dist/mi-dropdown-item.entry-b6aa9d36.mjs +0 -14
- package/dist/mi-dropdown-item.entry-be1c1055.mjs +0 -12
- package/dist/mi-dropdown.entry-1f1fce9f.mjs +0 -298
- package/dist/mi-dropdown.entry-43258637.mjs +0 -296
- package/dist/mi-dropdown.entry-e00c3e14.mjs +0 -296
- package/dist/mi-dropdown.entry-e1325610.mjs +0 -298
- package/dist/mi-keyboard.entry-60e47fb9.mjs +0 -2962
- package/dist/mi-keyboard.entry-c97c80e8.mjs +0 -2960
- package/dist/mi-keyboard.entry-e320a1e8.mjs +0 -2960
- package/dist/mi-keyboard.entry-f1813a27.mjs +0 -2962
- package/dist/mi-list-item-category.entry-6aa84b17.mjs +0 -38
- package/dist/mi-list-item-category.entry-b0f61751.mjs +0 -38
- package/dist/mi-list-item-category.entry-b5f547b8.mjs +0 -36
- package/dist/mi-list-item-category.entry-bcac342a.mjs +0 -36
- package/dist/mi-list-item-location.entry-15ec9c7e.mjs +0 -125
- package/dist/mi-list-item-location.entry-72f8d5db.mjs +0 -127
- package/dist/mi-list-item-location.entry-b642f1fb.mjs +0 -125
- package/dist/mi-list-item-location.entry-ee56967a.mjs +0 -127
- package/dist/mi-list.entry-656130ea.mjs +0 -41
- package/dist/mi-list.entry-6eddb682.mjs +0 -39
- package/dist/mi-list.entry-c8f1f377.mjs +0 -39
- package/dist/mi-list.entry-e8089911.mjs +0 -41
- package/dist/mi-location-booking.entry-36f5d6a4.mjs +0 -4865
- package/dist/mi-location-booking.entry-4424927f.mjs +0 -4863
- package/dist/mi-location-booking.entry-a5b9b331.mjs +0 -4863
- package/dist/mi-location-booking.entry-ea841d6e.mjs +0 -4865
- package/dist/mi-location-info.entry-2f1c328d.mjs +0 -24
- package/dist/mi-location-info.entry-78f0dbde.mjs +0 -22
- package/dist/mi-location-info.entry-89b37774.mjs +0 -22
- package/dist/mi-location-info.entry-fe2c6c32.mjs +0 -24
- package/dist/mi-map-googlemaps.entry-6cb264de.mjs +0 -398
- package/dist/mi-map-googlemaps.entry-73b0ae03.mjs +0 -396
- package/dist/mi-map-googlemaps.entry-85c05897.mjs +0 -398
- package/dist/mi-map-googlemaps.entry-8877f16d.mjs +0 -396
- package/dist/mi-map-mapbox.entry-7a41963d.mjs +0 -298
- package/dist/mi-map-mapbox.entry-928da21a.mjs +0 -300
- package/dist/mi-map-mapbox.entry-9fc28c96.mjs +0 -298
- package/dist/mi-map-mapbox.entry-a53b3e68.mjs +0 -300
- package/dist/mi-metric-card.entry-1215b29e.mjs +0 -26
- package/dist/mi-metric-card.entry-3d06eaea.mjs +0 -28
- package/dist/mi-metric-card.entry-51daca25.mjs +0 -28
- package/dist/mi-metric-card.entry-95dbb9f1.mjs +0 -26
- package/dist/mi-notification.entry-20418bdd.mjs +0 -83
- package/dist/mi-notification.entry-29b28ba8.mjs +0 -81
- package/dist/mi-notification.entry-9e49e3de.mjs +0 -81
- package/dist/mi-notification.entry-f7677761.mjs +0 -83
- package/dist/mi-route-instructions-heading.entry-60a49210.mjs +0 -72
- package/dist/mi-route-instructions-heading.entry-79c22cdd.mjs +0 -72
- package/dist/mi-route-instructions-heading.entry-874593f4.mjs +0 -74
- package/dist/mi-route-instructions-heading.entry-a4c7f18f.mjs +0 -74
- package/dist/mi-route-instructions-maneuver_2.entry-2950c143.mjs +0 -113
- package/dist/mi-route-instructions-maneuver_2.entry-383704ad.mjs +0 -115
- package/dist/mi-route-instructions-maneuver_2.entry-80c51e6a.mjs +0 -113
- package/dist/mi-route-instructions-maneuver_2.entry-b62eb513.mjs +0 -115
- package/dist/mi-route-instructions-step-legacy.entry-4058ea77.mjs +0 -201
- package/dist/mi-route-instructions-step-legacy.entry-785cb60b.mjs +0 -199
- package/dist/mi-route-instructions-step-legacy.entry-eff068ed.mjs +0 -201
- package/dist/mi-route-instructions-step-legacy.entry-f6ca174d.mjs +0 -199
- package/dist/mi-route-instructions-step.entry-057d5c48.mjs +0 -201
- package/dist/mi-route-instructions-step.entry-272e3c84.mjs +0 -199
- package/dist/mi-route-instructions-step.entry-8ecfdbd0.mjs +0 -199
- package/dist/mi-route-instructions-step.entry-95f5dc43.mjs +0 -201
- package/dist/mi-route-instructions.entry-0628d220.mjs +0 -139
- package/dist/mi-route-instructions.entry-1b4fb352.mjs +0 -141
- package/dist/mi-route-instructions.entry-2ded8acb.mjs +0 -141
- package/dist/mi-route-instructions.entry-4adef014.mjs +0 -139
- package/dist/mi-scroll-buttons.entry-274b003f.mjs +0 -48
- package/dist/mi-scroll-buttons.entry-55fa9459.mjs +0 -46
- package/dist/mi-scroll-buttons.entry-5ebd3f9b.mjs +0 -48
- package/dist/mi-scroll-buttons.entry-6132935b.mjs +0 -46
- package/dist/mi-search.entry-140efd52.mjs +0 -206
- package/dist/mi-search.entry-994c0189.mjs +0 -206
- package/dist/mi-search.entry-b04e74ff.mjs +0 -208
- package/dist/mi-search.entry-d0e582d1.mjs +0 -208
- package/dist/mi-share-sms.entry-26650f3b.mjs +0 -53
- package/dist/mi-share-sms.entry-ae15cf77.mjs +0 -53
- package/dist/mi-share-sms.entry-ced7f275.mjs +0 -55
- package/dist/mi-share-sms.entry-d082547b.mjs +0 -55
- package/dist/mi-step-switcher.entry-1863a369.mjs +0 -26
- package/dist/mi-step-switcher.entry-812a5096.mjs +0 -24
- package/dist/mi-step-switcher.entry-c9e28e79.mjs +0 -26
- package/dist/mi-step-switcher.entry-ecfc6a44.mjs +0 -24
- package/dist/mi-tab-panel.entry-089486fd.mjs +0 -21
- package/dist/mi-tab-panel.entry-63c34f28.mjs +0 -19
- package/dist/mi-tab-panel.entry-bde9bd39.mjs +0 -21
- package/dist/mi-tab-panel.entry-cbe08c18.mjs +0 -19
- package/dist/mi-tab.entry-1767468e.mjs +0 -13
- package/dist/mi-tab.entry-81e86bc6.mjs +0 -11
- package/dist/mi-tab.entry-b5ac50ac.mjs +0 -11
- package/dist/mi-tab.entry-ec6a52fb.mjs +0 -13
- package/dist/mi-tabs.entry-1209c5bb.mjs +0 -36
- package/dist/mi-tabs.entry-1b8327bf.mjs +0 -34
- package/dist/mi-tabs.entry-bd190e21.mjs +0 -36
- package/dist/mi-tabs.entry-c6b55639.mjs +0 -34
- package/dist/mi-variables-9a6c8d4d-e06eec88.mjs +0 -7
- package/dist/reactcomponent-2f9f051f.mjs +0 -27190
- package/dist/reactcomponent-aa96e777.mjs +0 -27210
- package/dist/route-travel-mode.enum-7f4ce9c7-a9c95a83.mjs +0 -7
- package/dist/sort-order.enum-64ce8998-b75ac596.mjs +0 -317
- package/dist/unit-system.enum-eaefb53e-0f424da4.mjs +0 -7
- package/dist/utils-ae714467-b07fc3be.mjs +0 -36
- package/dist/webcomponent-a10be1e6.mjs +0 -31969
- package/dist/webcomponent-ac588828.mjs +0 -31989
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
import { r as c, c as d, h as n, H as p, g as u } from "./reactcomponent-aa96e777.mjs";
|
|
2
|
-
import { S as m, f as g } from "./sort-order.enum-64ce8998-b75ac596.mjs";
|
|
3
|
-
import "react";
|
|
4
|
-
import "react-dom";
|
|
5
|
-
import "./_commonjsHelpers-ba3f0406-b96e6d6a.mjs";
|
|
6
|
-
const f = `.mi-input[type=text],.mi-input[type=search],.mi-input[type=number],.mi-input[type=password],.mi-input[type=tel]{font-size:1rem;padding:8px;border-style:solid;border-width:1px;border-color:#8d98aa;border-radius:4px}.mi-input[type=text],.mi-input[type=search],.mi-input[type=number],.mi-input[type=password],.mi-input[type=range],.mi-input[type=tel]{display:block}.mi-input[type=radio],.mi-input[type=checkbox]{margin:0px;transform:scale(1.2, 1.2)}.mi-input[type=search]{padding-left:32px;background:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 24 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14.6267 8.43836C14.6267 11.8561 11.8561 14.6267 8.43836 14.6267C5.02062 14.6267 2.25 11.8561 2.25 8.43836C2.25 5.02062 5.02062 2.25 8.43836 2.25C11.8561 2.25 14.6267 5.02062 14.6267 8.43836Z' stroke='%23aeb9cb' stroke-width='2.5'/%3E%3Crect x='15.0979' y='14.1614' width='7.34678' height='1.32449' rx='0.662244' transform='rotate(45 15.0979 14.1614)' fill='%23aeb9cb' stroke='%23aeb9cb'/%3E%3Crect x='13.7847' y='13.2916' width='1.05276' height='0.697347' transform='rotate(45 13.7847 13.2916)' stroke='%23aeb9cb' stroke-width='0.697346'/%3E%3C/svg%3E%0A") no-repeat scroll 8px center, white}.mi-input:disabled{opacity:0.48;cursor:not-allowed}.mi-label{font-style:normal;display:block;font-size:1rem;font-weight:500;color:#1e2025}.mi-label>*{margin-top:4px}.mi-label>input[type=radio],.mi-label>input[type=checkbox],.mi-label>label.mi-toggle-btn{margin-right:8px}combo-box-item{display:none}:host{display:inline-block;position:relative;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"}:host(.open) .button::after{border-top-color:transparent;border-bottom-color:#1f2937;margin-top:-8px}:host(.open) section{display:flex}:host(.open) svg{transform:rotate(180deg)}.input{position:relative;display:flex;justify-content:flex-start;align-items:center;height:100%;width:100%;font-family:inherit;background:linear-gradient(#f9fafb, #f3f4f6);border-radius:4px;border-width:1px;border-style:solid;border-color:#d1d5db;color:#1c1917;font-size:1rem;font-weight:500;line-height:1rem;padding-right:40px;padding-left:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.input__svg{margin-left:auto;position:absolute;top:50%;right:-42px}.input__label{padding-top:12px;padding-bottom:12px;margin-right:8px;display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.input__label--from-inner-html{display:flex;flex-direction:row;align-items:center;gap:8px}.input:disabled{opacity:0.72;cursor:not-allowed}.content{padding-top:12px;padding-bottom:12px;margin-top:12px;margin-bottom:12px;border-radius:8px;color:#1c1917;font-size:1rem;font-weight:500;background-color:#fcfcfc;box-shadow:0px 2px 2px rgba(0, 0, 0, 0.2), 0px 4px 4px rgba(0, 0, 0, 0.18), 0px 8px 8px rgba(0, 0, 0, 0.16);min-width:320px;max-width:480px;max-height:580px;display:none;flex-direction:column;position:fixed;z-index:10000}.content .list{padding:0;margin:0;list-style:none;overflow-y:auto}.content .list__item{cursor:pointer}.content .list__item--highlighted{background-color:#f3f4f6}.empty-page{display:flex;align-items:left;flex-direction:column;margin-left:16px;margin-bottom:12px}.empty-page>*{margin:0}.empty-page__header{font-size:1rem;font-weight:400;color:#374151}.label{display:flex;flex-direction:row;align-items:center;padding-left:16px;padding-right:16px;padding-top:8px;padding-bottom:8px}.label__item{display:inline-block;margin-top:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.label__item--from-inner-html{display:flex;flex-direction:row;align-items:center;gap:8px}.label__checkbox{margin-right:12px}.label__checkbox--hidden{display:none}`;
|
|
7
|
-
var l;
|
|
8
|
-
(function(e) {
|
|
9
|
-
e.ArrowDown = "ArrowDown", e.ArrowUp = "ArrowUp", e.Enter = "Enter", e.Esc = "Escape";
|
|
10
|
-
})(l || (l = {}));
|
|
11
|
-
const x = class {
|
|
12
|
-
constructor(e) {
|
|
13
|
-
c(this, e), this.change = d(this, "change", 3), this.isFilterSelectionDisabled = !1, this.isMouseOverEventDisabled = !1, this.currentItemIndex = 0, this.selectedItemIndex = 0, this.highlightedItemClassName = "list__item--highlighted", this.open = !1, this.items = [], this.itemsOrder = void 0, this.filterable = !1, this.selected = [], this.noResultsMessage = "No results found", this.currentItems = [], this.disabled = !1;
|
|
14
|
-
}
|
|
15
|
-
onItemsChanged(e) {
|
|
16
|
-
if (e.some((t) => t.tagName.toLowerCase() !== "combo-box-item"))
|
|
17
|
-
throw new Error("Items contains unknown element(s).");
|
|
18
|
-
if (Object.values(m).includes(this.itemsOrder) && (e = this.getSortedItems(e)), this.currentItems = [...e], this.filter(), !this.filterable) {
|
|
19
|
-
const t = this.currentItems.findIndex((i) => i.selected);
|
|
20
|
-
this.currentItemIndex = t > -1 ? t : 0, this.selectedItemIndex = this.currentItemIndex;
|
|
21
|
-
}
|
|
22
|
-
this.items.forEach((t, i) => {
|
|
23
|
-
t.dataset.index = i.toString();
|
|
24
|
-
}), this.selectFirstMiDropdownItem();
|
|
25
|
-
}
|
|
26
|
-
onCurrentItemsChange() {
|
|
27
|
-
this.isFilterSelectionDisabled = this.currentItems.length === 0;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Outside the dropdown listener. It will close the dropdown when a click is outside a dropdown and dropdown list.
|
|
31
|
-
*
|
|
32
|
-
* @param {ev} ev
|
|
33
|
-
*/
|
|
34
|
-
checkForClickOutside(e) {
|
|
35
|
-
var t;
|
|
36
|
-
!this.hostElement.contains(e.target) && this.noResultsMessage && (this.clearFilter(), this.filterElement.value = (t = this.selected[0]) === null || t === void 0 ? void 0 : t.text, this.open = !1);
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* When clicked on input button we change it's type to text and highlight value that is inside.
|
|
40
|
-
*
|
|
41
|
-
* @param {Event} event
|
|
42
|
-
*/
|
|
43
|
-
onClickExists(e) {
|
|
44
|
-
this.open = !0, e.target.type = "text", this.filterElement.select();
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Mousemove event handler.
|
|
48
|
-
* When the mouse is moved the mouseover event handler is enabled.
|
|
49
|
-
*/
|
|
50
|
-
mouseMoveEventHandler() {
|
|
51
|
-
this.isMouseOverEventDisabled = !1;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Scroll event handler.
|
|
55
|
-
* The dropdown is closed when the scroll event is trigget outside the dropdown.
|
|
56
|
-
*/
|
|
57
|
-
scrollEventHandler(e) {
|
|
58
|
-
const t = e.target;
|
|
59
|
-
(!t || !this.hostElement.contains(t)) && (this.open = !1);
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Resize event handler.
|
|
63
|
-
* Recalculate the position of the dropdown when the window is resized.
|
|
64
|
-
*/
|
|
65
|
-
resizeEventHandler() {
|
|
66
|
-
this.calculateDropDownPosition();
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Component did load.
|
|
70
|
-
*/
|
|
71
|
-
componentDidLoad() {
|
|
72
|
-
this.createMiDropdownItemsFromDocument(), this.selectFirstMiDropdownItem(), this.enableKeyboardNavigationEvents();
|
|
73
|
-
const e = new IntersectionObserver((t) => {
|
|
74
|
-
t.forEach((i) => {
|
|
75
|
-
i.isIntersecting === !0 && this.filterElement.blur();
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
this.filterElement !== void 0 && (e.observe(this.filterElement), this.filterElement.addEventListener("keydown", (t) => {
|
|
79
|
-
(t.key === l.ArrowDown || t.key === l.ArrowUp) && t.preventDefault();
|
|
80
|
-
}));
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Component did rener.
|
|
84
|
-
*/
|
|
85
|
-
componentDidRender() {
|
|
86
|
-
this.calculateDropDownPosition(), this.filterable || this.highlightItem(this.currentItemIndex, !0);
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Gets all mi-dropdown-item elements for the mi-dropdown items property.
|
|
90
|
-
*/
|
|
91
|
-
createMiDropdownItemsFromDocument() {
|
|
92
|
-
const e = this.items && this.items.length > 0 ? this.items : this.hostElement.querySelectorAll("combo-box-item");
|
|
93
|
-
e.length > 0 && (this.items = Array.from(e));
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Set the first mi-dropdown-item as the textual content of the button.
|
|
97
|
-
*/
|
|
98
|
-
selectFirstMiDropdownItem() {
|
|
99
|
-
var e;
|
|
100
|
-
if (!this.filterable) {
|
|
101
|
-
const t = (e = this.items) === null || e === void 0 ? void 0 : e.findIndex((i) => i.selected);
|
|
102
|
-
this.selected = [this.items[t > -1 ? t : 0]];
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Enables cycling through the items in the content window using arrow up/down keys.
|
|
107
|
-
*/
|
|
108
|
-
enableKeyboardNavigationEvents() {
|
|
109
|
-
this.hostElement.addEventListener("keydown", (e) => {
|
|
110
|
-
if (this.open === !1 && e.key === l.ArrowDown) {
|
|
111
|
-
this.isMouseOverEventDisabled = !0, this.toggleContentWindow(), e.preventDefault();
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
if (this.open === !0 && !this.filterable)
|
|
115
|
-
switch (e.key) {
|
|
116
|
-
case (l.ArrowDown || l.ArrowUp):
|
|
117
|
-
this.isMouseOverEventDisabled = !0, this.currentItemIndex = (this.currentItemIndex + 1) % this.currentItems.length, this.highlightItem(this.currentItemIndex, !0), e.preventDefault();
|
|
118
|
-
break;
|
|
119
|
-
case l.ArrowUp:
|
|
120
|
-
this.isMouseOverEventDisabled = !0, this.currentItemIndex = (this.currentItemIndex + this.currentItems.length - 1) % this.currentItems.length, this.highlightItem(this.currentItemIndex, !0), e.preventDefault();
|
|
121
|
-
break;
|
|
122
|
-
case l.Enter:
|
|
123
|
-
if (this.hostElement.shadowRoot.activeElement === this.clearButtonElement)
|
|
124
|
-
return;
|
|
125
|
-
this.currentItems[this.currentItemIndex] !== void 0 && this.onSelect(this.currentItems[this.currentItemIndex]), e.preventDefault();
|
|
126
|
-
break;
|
|
127
|
-
}
|
|
128
|
-
e.key === l.Esc && (this.filterable || (this.currentItemIndex = this.selectedItemIndex, this.highlightItem(this.currentItemIndex)), this.toggleContentWindow(), this.clearFilter());
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Updates the currently highlighted item in the markup.
|
|
133
|
-
*
|
|
134
|
-
* @param {number} itemIndex
|
|
135
|
-
*/
|
|
136
|
-
highlightItem(e, t = !1) {
|
|
137
|
-
var i, s;
|
|
138
|
-
const r = this.hostElement.shadowRoot.querySelectorAll(".list__item");
|
|
139
|
-
r.forEach((a) => {
|
|
140
|
-
a.classList.remove(this.highlightedItemClassName);
|
|
141
|
-
}), (i = r[e]) === null || i === void 0 || i.classList.add(this.highlightedItemClassName), t && ((s = r[e]) === null || s === void 0 || s.scrollIntoView({ block: "nearest", inline: "nearest" }));
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Get sorted items.
|
|
145
|
-
* The sorting order is defined by the itemsOrder attribute.
|
|
146
|
-
*
|
|
147
|
-
* @param {HTMLMiDropdownItemElement[]} items
|
|
148
|
-
* @returns {HTMLMiDropdownItemElement[]}
|
|
149
|
-
*/
|
|
150
|
-
getSortedItems(e) {
|
|
151
|
-
return this.itemsOrder === m.Asc ? e.sort((t, i) => (t.text || t.innerText).trimStart().toLowerCase().localeCompare((i.text || i.innerText).trimStart().toLowerCase(), void 0, { numeric: !0 })) : e.sort((t, i) => (i.text || i.innerText).trimStart().toLowerCase().localeCompare((t.text || t.innerText).trimStart().toLowerCase(), void 0, { numeric: !0 })), e;
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Update and emit list of selected items.
|
|
155
|
-
*/
|
|
156
|
-
onChangedHandler() {
|
|
157
|
-
this.selected = [...this.items.filter((e) => e.selected)], this.change.emit(this.selected);
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Toggle visibility of content window.
|
|
161
|
-
*/
|
|
162
|
-
toggleContentWindow() {
|
|
163
|
-
this.open = !this.open;
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Select or toggle selection of item.
|
|
167
|
-
*
|
|
168
|
-
* @param {HTMLMiDropdownItemElement} item
|
|
169
|
-
*/
|
|
170
|
-
onSelect(e) {
|
|
171
|
-
this.filterable || (this.open = !1, Array.from(this.items).forEach((i) => {
|
|
172
|
-
i.selected = !1;
|
|
173
|
-
}), this.clearFilter()), e.selected = !e.selected, this.currentItemIndex = Number(e.dataset.index), this.selectedItemIndex = this.currentItemIndex, this.onChangedHandler();
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Highlights the item that the cursor is hovering in the content window.
|
|
177
|
-
*
|
|
178
|
-
* @param {number} filteredItemsIndex
|
|
179
|
-
*/
|
|
180
|
-
onMouseOver(e) {
|
|
181
|
-
!this.isMouseOverEventDisabled && !this.filterable && (this.highlightItem(e), this.currentItemIndex = e);
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Filter items based on input query.
|
|
185
|
-
*
|
|
186
|
-
* @returns {HTMLMiDropdownItemElement[]}
|
|
187
|
-
*/
|
|
188
|
-
filter() {
|
|
189
|
-
if (this.filterElement) {
|
|
190
|
-
const e = this.filterElement.value, t = this.items.map((o) => o.text || o.innerText), i = this.currentItems.length;
|
|
191
|
-
if (e === "")
|
|
192
|
-
return this.currentItemIndex = this.selectedItemIndex, this.currentItems = [...this.items];
|
|
193
|
-
const s = {
|
|
194
|
-
limit: 50,
|
|
195
|
-
allowTypo: !1,
|
|
196
|
-
threshold: -1e4
|
|
197
|
-
}, a = g.go(e, t, s).map((o) => this.items.find((h) => (h.text || h.innerText) === o.target));
|
|
198
|
-
this.currentItems = a, i !== this.currentItems.length && (this.currentItemIndex = 0);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Clear filter.
|
|
203
|
-
*/
|
|
204
|
-
clearFilter() {
|
|
205
|
-
var e;
|
|
206
|
-
this.filterElement && (this.filterElement.value = (e = this.selected[0]) === null || e === void 0 ? void 0 : e.text, this.filterElement.blur(), this.currentItems = this.items);
|
|
207
|
-
}
|
|
208
|
-
/**
|
|
209
|
-
* Render input field - combobox.
|
|
210
|
-
*
|
|
211
|
-
* @returns {Host}
|
|
212
|
-
*/
|
|
213
|
-
render() {
|
|
214
|
-
var e;
|
|
215
|
-
const t = n("ul", { class: "list" }, this.currentItems.map((i, s) => this.renderListItem(i, s, this.filterable)));
|
|
216
|
-
return n(p, { class: { open: this.open } }, n("input", { type: "text", class: "input", onFocus: (i) => this.onClickExists(i), ref: (i) => this.filterElement = i, onInput: () => this.filter(), tabIndex: 0, value: (e = this.selected[0]) === null || e === void 0 ? void 0 : e.text }), n("svg", { role: "button", class: "input__svg", part: "icon-down-arrow", width: "12", height: "6", viewBox: "0 0 18 10", xmlns: "http://www.w3.org/2000/svg", onClick: () => this.toggleContentWindow() }, n("path", { d: "M9.37165 9.58706C9.17303 9.80775 8.82697 9.80775 8.62835 9.58706L0.751035 0.834484C0.46145 0.512722 0.689796 7.73699e-08 1.12268 1.25924e-07L16.8773 1.89302e-06C17.3102 1.94157e-06 17.5386 0.512723 17.249 0.834484L9.37165 9.58706Z" })), n("section", { ref: (i) => this.listElement = i, part: "dropdown-container", class: "content" }, this.currentItems.length === 0 ? this.renderNoResultsTemplate() : t));
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* Helper function to render markup when no items are available to be displayed in the content window.
|
|
220
|
-
*
|
|
221
|
-
* @returns {JSX.Element}
|
|
222
|
-
*/
|
|
223
|
-
renderNoResultsTemplate() {
|
|
224
|
-
return n("div", { class: "empty-page" }, n("p", { class: "empty-page__header" }, this.noResultsMessage));
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Helper function for rendering list item.
|
|
228
|
-
*
|
|
229
|
-
* @param {HTMLMiDropdownItemElement} item
|
|
230
|
-
* @param {number} index
|
|
231
|
-
* @param {boolean} showCheckBox
|
|
232
|
-
* @returns {JSX.Element}
|
|
233
|
-
*/
|
|
234
|
-
renderListItem(e, t, i) {
|
|
235
|
-
let s;
|
|
236
|
-
const r = e.getAttribute("title") || e.text || e.innerText;
|
|
237
|
-
return e.innerText.length > 0 ? s = n("div", { class: "label__item label__item--from-inner-html", innerHTML: e.innerHTML }) : s = n("div", { class: "label__item", innerHTML: e.text }), n("li", { class: "list__item", title: r, onMouseOver: () => {
|
|
238
|
-
this.onMouseOver(t);
|
|
239
|
-
} }, n("label", { class: "mi-label label", tabindex: "-1" }, n("input", { class: { label__checkbox: !0, "label__checkbox--hidden": !i, "mi-input": !0 }, type: "checkbox", value: t, checked: e.selected, onChange: () => this.onSelect(e) }), s));
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Function for calculating the position of the dropdown list element.
|
|
243
|
-
*/
|
|
244
|
-
calculateDropDownPosition() {
|
|
245
|
-
this.listElement.style.bottom = null, this.listElement.style.left = null, this.listElement.style.right = null, this.listElement.style.top = null, this.listElement.style.maxHeight = null, this.listElement.style.minWidth = null;
|
|
246
|
-
const { clientWidth: e, clientHeight: t } = document.documentElement, i = this.hostElement.getBoundingClientRect(), s = this.listElement.getBoundingClientRect(), r = t - i.bottom, a = i.top, o = 580, h = 12;
|
|
247
|
-
e <= s.width || i.right - s.width < 0 && s.right > e ? (this.listElement.style.right = `${h}px`, this.listElement.style.left = `${h}px`, this.listElement.style.minWidth = "unset") : s.right > e ? (this.listElement.style.left = "unset", this.listElement.style.right = `${e - i.right}px`) : (this.listElement.style.left = `${i.left}px`, this.listElement.style.right = "unset"), a > r ? (this.listElement.style.maxHeight = `${Math.min(a, o)}px`, this.listElement.style.top = "unset", this.listElement.style.bottom = `${t - i.top}px`) : (this.listElement.style.top = `${i.bottom}px`, this.listElement.style.bottom = "unset", this.listElement.style.maxHeight = `${Math.min(r - h * 2, o)}px`);
|
|
248
|
-
}
|
|
249
|
-
get hostElement() {
|
|
250
|
-
return u(this);
|
|
251
|
-
}
|
|
252
|
-
static get watchers() {
|
|
253
|
-
return {
|
|
254
|
-
items: ["onItemsChanged"],
|
|
255
|
-
currentItems: ["onCurrentItemsChange"]
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
};
|
|
259
|
-
x.style = f;
|
|
260
|
-
export {
|
|
261
|
-
x as mi_combo_box
|
|
262
|
-
};
|
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
import { r as c, c as d, h as n, H as p, g as u } from "./webcomponent-a10be1e6.mjs";
|
|
2
|
-
import { S as m, f as g } from "./sort-order.enum-64ce8998-b75ac596.mjs";
|
|
3
|
-
import "./_commonjsHelpers-ba3f0406-b96e6d6a.mjs";
|
|
4
|
-
const f = `.mi-input[type=text],.mi-input[type=search],.mi-input[type=number],.mi-input[type=password],.mi-input[type=tel]{font-size:1rem;padding:8px;border-style:solid;border-width:1px;border-color:#8d98aa;border-radius:4px}.mi-input[type=text],.mi-input[type=search],.mi-input[type=number],.mi-input[type=password],.mi-input[type=range],.mi-input[type=tel]{display:block}.mi-input[type=radio],.mi-input[type=checkbox]{margin:0px;transform:scale(1.2, 1.2)}.mi-input[type=search]{padding-left:32px;background:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 24 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14.6267 8.43836C14.6267 11.8561 11.8561 14.6267 8.43836 14.6267C5.02062 14.6267 2.25 11.8561 2.25 8.43836C2.25 5.02062 5.02062 2.25 8.43836 2.25C11.8561 2.25 14.6267 5.02062 14.6267 8.43836Z' stroke='%23aeb9cb' stroke-width='2.5'/%3E%3Crect x='15.0979' y='14.1614' width='7.34678' height='1.32449' rx='0.662244' transform='rotate(45 15.0979 14.1614)' fill='%23aeb9cb' stroke='%23aeb9cb'/%3E%3Crect x='13.7847' y='13.2916' width='1.05276' height='0.697347' transform='rotate(45 13.7847 13.2916)' stroke='%23aeb9cb' stroke-width='0.697346'/%3E%3C/svg%3E%0A") no-repeat scroll 8px center, white}.mi-input:disabled{opacity:0.48;cursor:not-allowed}.mi-label{font-style:normal;display:block;font-size:1rem;font-weight:500;color:#1e2025}.mi-label>*{margin-top:4px}.mi-label>input[type=radio],.mi-label>input[type=checkbox],.mi-label>label.mi-toggle-btn{margin-right:8px}combo-box-item{display:none}:host{display:inline-block;position:relative;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"}:host(.open) .button::after{border-top-color:transparent;border-bottom-color:#1f2937;margin-top:-8px}:host(.open) section{display:flex}:host(.open) svg{transform:rotate(180deg)}.input{position:relative;display:flex;justify-content:flex-start;align-items:center;height:100%;width:100%;font-family:inherit;background:linear-gradient(#f9fafb, #f3f4f6);border-radius:4px;border-width:1px;border-style:solid;border-color:#d1d5db;color:#1c1917;font-size:1rem;font-weight:500;line-height:1rem;padding-right:40px;padding-left:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.input__svg{margin-left:auto;position:absolute;top:50%;right:-42px}.input__label{padding-top:12px;padding-bottom:12px;margin-right:8px;display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.input__label--from-inner-html{display:flex;flex-direction:row;align-items:center;gap:8px}.input:disabled{opacity:0.72;cursor:not-allowed}.content{padding-top:12px;padding-bottom:12px;margin-top:12px;margin-bottom:12px;border-radius:8px;color:#1c1917;font-size:1rem;font-weight:500;background-color:#fcfcfc;box-shadow:0px 2px 2px rgba(0, 0, 0, 0.2), 0px 4px 4px rgba(0, 0, 0, 0.18), 0px 8px 8px rgba(0, 0, 0, 0.16);min-width:320px;max-width:480px;max-height:580px;display:none;flex-direction:column;position:fixed;z-index:10000}.content .list{padding:0;margin:0;list-style:none;overflow-y:auto}.content .list__item{cursor:pointer}.content .list__item--highlighted{background-color:#f3f4f6}.empty-page{display:flex;align-items:left;flex-direction:column;margin-left:16px;margin-bottom:12px}.empty-page>*{margin:0}.empty-page__header{font-size:1rem;font-weight:400;color:#374151}.label{display:flex;flex-direction:row;align-items:center;padding-left:16px;padding-right:16px;padding-top:8px;padding-bottom:8px}.label__item{display:inline-block;margin-top:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.label__item--from-inner-html{display:flex;flex-direction:row;align-items:center;gap:8px}.label__checkbox{margin-right:12px}.label__checkbox--hidden{display:none}`;
|
|
5
|
-
var l;
|
|
6
|
-
(function(e) {
|
|
7
|
-
e.ArrowDown = "ArrowDown", e.ArrowUp = "ArrowUp", e.Enter = "Enter", e.Esc = "Escape";
|
|
8
|
-
})(l || (l = {}));
|
|
9
|
-
const x = class {
|
|
10
|
-
constructor(e) {
|
|
11
|
-
c(this, e), this.change = d(this, "change", 3), this.isFilterSelectionDisabled = !1, this.isMouseOverEventDisabled = !1, this.currentItemIndex = 0, this.selectedItemIndex = 0, this.highlightedItemClassName = "list__item--highlighted", this.open = !1, this.items = [], this.itemsOrder = void 0, this.filterable = !1, this.selected = [], this.noResultsMessage = "No results found", this.currentItems = [], this.disabled = !1;
|
|
12
|
-
}
|
|
13
|
-
onItemsChanged(e) {
|
|
14
|
-
if (e.some((t) => t.tagName.toLowerCase() !== "combo-box-item"))
|
|
15
|
-
throw new Error("Items contains unknown element(s).");
|
|
16
|
-
if (Object.values(m).includes(this.itemsOrder) && (e = this.getSortedItems(e)), this.currentItems = [...e], this.filter(), !this.filterable) {
|
|
17
|
-
const t = this.currentItems.findIndex((i) => i.selected);
|
|
18
|
-
this.currentItemIndex = t > -1 ? t : 0, this.selectedItemIndex = this.currentItemIndex;
|
|
19
|
-
}
|
|
20
|
-
this.items.forEach((t, i) => {
|
|
21
|
-
t.dataset.index = i.toString();
|
|
22
|
-
}), this.selectFirstMiDropdownItem();
|
|
23
|
-
}
|
|
24
|
-
onCurrentItemsChange() {
|
|
25
|
-
this.isFilterSelectionDisabled = this.currentItems.length === 0;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Outside the dropdown listener. It will close the dropdown when a click is outside a dropdown and dropdown list.
|
|
29
|
-
*
|
|
30
|
-
* @param {ev} ev
|
|
31
|
-
*/
|
|
32
|
-
checkForClickOutside(e) {
|
|
33
|
-
var t;
|
|
34
|
-
!this.hostElement.contains(e.target) && this.noResultsMessage && (this.clearFilter(), this.filterElement.value = (t = this.selected[0]) === null || t === void 0 ? void 0 : t.text, this.open = !1);
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* When clicked on input button we change it's type to text and highlight value that is inside.
|
|
38
|
-
*
|
|
39
|
-
* @param {Event} event
|
|
40
|
-
*/
|
|
41
|
-
onClickExists(e) {
|
|
42
|
-
this.open = !0, e.target.type = "text", this.filterElement.select();
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Mousemove event handler.
|
|
46
|
-
* When the mouse is moved the mouseover event handler is enabled.
|
|
47
|
-
*/
|
|
48
|
-
mouseMoveEventHandler() {
|
|
49
|
-
this.isMouseOverEventDisabled = !1;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Scroll event handler.
|
|
53
|
-
* The dropdown is closed when the scroll event is trigget outside the dropdown.
|
|
54
|
-
*/
|
|
55
|
-
scrollEventHandler(e) {
|
|
56
|
-
const t = e.target;
|
|
57
|
-
(!t || !this.hostElement.contains(t)) && (this.open = !1);
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Resize event handler.
|
|
61
|
-
* Recalculate the position of the dropdown when the window is resized.
|
|
62
|
-
*/
|
|
63
|
-
resizeEventHandler() {
|
|
64
|
-
this.calculateDropDownPosition();
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Component did load.
|
|
68
|
-
*/
|
|
69
|
-
componentDidLoad() {
|
|
70
|
-
this.createMiDropdownItemsFromDocument(), this.selectFirstMiDropdownItem(), this.enableKeyboardNavigationEvents();
|
|
71
|
-
const e = new IntersectionObserver((t) => {
|
|
72
|
-
t.forEach((i) => {
|
|
73
|
-
i.isIntersecting === !0 && this.filterElement.blur();
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
this.filterElement !== void 0 && (e.observe(this.filterElement), this.filterElement.addEventListener("keydown", (t) => {
|
|
77
|
-
(t.key === l.ArrowDown || t.key === l.ArrowUp) && t.preventDefault();
|
|
78
|
-
}));
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Component did rener.
|
|
82
|
-
*/
|
|
83
|
-
componentDidRender() {
|
|
84
|
-
this.calculateDropDownPosition(), this.filterable || this.highlightItem(this.currentItemIndex, !0);
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Gets all mi-dropdown-item elements for the mi-dropdown items property.
|
|
88
|
-
*/
|
|
89
|
-
createMiDropdownItemsFromDocument() {
|
|
90
|
-
const e = this.items && this.items.length > 0 ? this.items : this.hostElement.querySelectorAll("combo-box-item");
|
|
91
|
-
e.length > 0 && (this.items = Array.from(e));
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Set the first mi-dropdown-item as the textual content of the button.
|
|
95
|
-
*/
|
|
96
|
-
selectFirstMiDropdownItem() {
|
|
97
|
-
var e;
|
|
98
|
-
if (!this.filterable) {
|
|
99
|
-
const t = (e = this.items) === null || e === void 0 ? void 0 : e.findIndex((i) => i.selected);
|
|
100
|
-
this.selected = [this.items[t > -1 ? t : 0]];
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Enables cycling through the items in the content window using arrow up/down keys.
|
|
105
|
-
*/
|
|
106
|
-
enableKeyboardNavigationEvents() {
|
|
107
|
-
this.hostElement.addEventListener("keydown", (e) => {
|
|
108
|
-
if (this.open === !1 && e.key === l.ArrowDown) {
|
|
109
|
-
this.isMouseOverEventDisabled = !0, this.toggleContentWindow(), e.preventDefault();
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
if (this.open === !0 && !this.filterable)
|
|
113
|
-
switch (e.key) {
|
|
114
|
-
case (l.ArrowDown || l.ArrowUp):
|
|
115
|
-
this.isMouseOverEventDisabled = !0, this.currentItemIndex = (this.currentItemIndex + 1) % this.currentItems.length, this.highlightItem(this.currentItemIndex, !0), e.preventDefault();
|
|
116
|
-
break;
|
|
117
|
-
case l.ArrowUp:
|
|
118
|
-
this.isMouseOverEventDisabled = !0, this.currentItemIndex = (this.currentItemIndex + this.currentItems.length - 1) % this.currentItems.length, this.highlightItem(this.currentItemIndex, !0), e.preventDefault();
|
|
119
|
-
break;
|
|
120
|
-
case l.Enter:
|
|
121
|
-
if (this.hostElement.shadowRoot.activeElement === this.clearButtonElement)
|
|
122
|
-
return;
|
|
123
|
-
this.currentItems[this.currentItemIndex] !== void 0 && this.onSelect(this.currentItems[this.currentItemIndex]), e.preventDefault();
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
e.key === l.Esc && (this.filterable || (this.currentItemIndex = this.selectedItemIndex, this.highlightItem(this.currentItemIndex)), this.toggleContentWindow(), this.clearFilter());
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Updates the currently highlighted item in the markup.
|
|
131
|
-
*
|
|
132
|
-
* @param {number} itemIndex
|
|
133
|
-
*/
|
|
134
|
-
highlightItem(e, t = !1) {
|
|
135
|
-
var i, s;
|
|
136
|
-
const r = this.hostElement.shadowRoot.querySelectorAll(".list__item");
|
|
137
|
-
r.forEach((a) => {
|
|
138
|
-
a.classList.remove(this.highlightedItemClassName);
|
|
139
|
-
}), (i = r[e]) === null || i === void 0 || i.classList.add(this.highlightedItemClassName), t && ((s = r[e]) === null || s === void 0 || s.scrollIntoView({ block: "nearest", inline: "nearest" }));
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Get sorted items.
|
|
143
|
-
* The sorting order is defined by the itemsOrder attribute.
|
|
144
|
-
*
|
|
145
|
-
* @param {HTMLMiDropdownItemElement[]} items
|
|
146
|
-
* @returns {HTMLMiDropdownItemElement[]}
|
|
147
|
-
*/
|
|
148
|
-
getSortedItems(e) {
|
|
149
|
-
return this.itemsOrder === m.Asc ? e.sort((t, i) => (t.text || t.innerText).trimStart().toLowerCase().localeCompare((i.text || i.innerText).trimStart().toLowerCase(), void 0, { numeric: !0 })) : e.sort((t, i) => (i.text || i.innerText).trimStart().toLowerCase().localeCompare((t.text || t.innerText).trimStart().toLowerCase(), void 0, { numeric: !0 })), e;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Update and emit list of selected items.
|
|
153
|
-
*/
|
|
154
|
-
onChangedHandler() {
|
|
155
|
-
this.selected = [...this.items.filter((e) => e.selected)], this.change.emit(this.selected);
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Toggle visibility of content window.
|
|
159
|
-
*/
|
|
160
|
-
toggleContentWindow() {
|
|
161
|
-
this.open = !this.open;
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Select or toggle selection of item.
|
|
165
|
-
*
|
|
166
|
-
* @param {HTMLMiDropdownItemElement} item
|
|
167
|
-
*/
|
|
168
|
-
onSelect(e) {
|
|
169
|
-
this.filterable || (this.open = !1, Array.from(this.items).forEach((i) => {
|
|
170
|
-
i.selected = !1;
|
|
171
|
-
}), this.clearFilter()), e.selected = !e.selected, this.currentItemIndex = Number(e.dataset.index), this.selectedItemIndex = this.currentItemIndex, this.onChangedHandler();
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Highlights the item that the cursor is hovering in the content window.
|
|
175
|
-
*
|
|
176
|
-
* @param {number} filteredItemsIndex
|
|
177
|
-
*/
|
|
178
|
-
onMouseOver(e) {
|
|
179
|
-
!this.isMouseOverEventDisabled && !this.filterable && (this.highlightItem(e), this.currentItemIndex = e);
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Filter items based on input query.
|
|
183
|
-
*
|
|
184
|
-
* @returns {HTMLMiDropdownItemElement[]}
|
|
185
|
-
*/
|
|
186
|
-
filter() {
|
|
187
|
-
if (this.filterElement) {
|
|
188
|
-
const e = this.filterElement.value, t = this.items.map((o) => o.text || o.innerText), i = this.currentItems.length;
|
|
189
|
-
if (e === "")
|
|
190
|
-
return this.currentItemIndex = this.selectedItemIndex, this.currentItems = [...this.items];
|
|
191
|
-
const s = {
|
|
192
|
-
limit: 50,
|
|
193
|
-
allowTypo: !1,
|
|
194
|
-
threshold: -1e4
|
|
195
|
-
}, a = g.go(e, t, s).map((o) => this.items.find((h) => (h.text || h.innerText) === o.target));
|
|
196
|
-
this.currentItems = a, i !== this.currentItems.length && (this.currentItemIndex = 0);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Clear filter.
|
|
201
|
-
*/
|
|
202
|
-
clearFilter() {
|
|
203
|
-
var e;
|
|
204
|
-
this.filterElement && (this.filterElement.value = (e = this.selected[0]) === null || e === void 0 ? void 0 : e.text, this.filterElement.blur(), this.currentItems = this.items);
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Render input field - combobox.
|
|
208
|
-
*
|
|
209
|
-
* @returns {Host}
|
|
210
|
-
*/
|
|
211
|
-
render() {
|
|
212
|
-
var e;
|
|
213
|
-
const t = n("ul", { class: "list" }, this.currentItems.map((i, s) => this.renderListItem(i, s, this.filterable)));
|
|
214
|
-
return n(p, { class: { open: this.open } }, n("input", { type: "text", class: "input", onFocus: (i) => this.onClickExists(i), ref: (i) => this.filterElement = i, onInput: () => this.filter(), tabIndex: 0, value: (e = this.selected[0]) === null || e === void 0 ? void 0 : e.text }), n("svg", { role: "button", class: "input__svg", part: "icon-down-arrow", width: "12", height: "6", viewBox: "0 0 18 10", xmlns: "http://www.w3.org/2000/svg", onClick: () => this.toggleContentWindow() }, n("path", { d: "M9.37165 9.58706C9.17303 9.80775 8.82697 9.80775 8.62835 9.58706L0.751035 0.834484C0.46145 0.512722 0.689796 7.73699e-08 1.12268 1.25924e-07L16.8773 1.89302e-06C17.3102 1.94157e-06 17.5386 0.512723 17.249 0.834484L9.37165 9.58706Z" })), n("section", { ref: (i) => this.listElement = i, part: "dropdown-container", class: "content" }, this.currentItems.length === 0 ? this.renderNoResultsTemplate() : t));
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Helper function to render markup when no items are available to be displayed in the content window.
|
|
218
|
-
*
|
|
219
|
-
* @returns {JSX.Element}
|
|
220
|
-
*/
|
|
221
|
-
renderNoResultsTemplate() {
|
|
222
|
-
return n("div", { class: "empty-page" }, n("p", { class: "empty-page__header" }, this.noResultsMessage));
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Helper function for rendering list item.
|
|
226
|
-
*
|
|
227
|
-
* @param {HTMLMiDropdownItemElement} item
|
|
228
|
-
* @param {number} index
|
|
229
|
-
* @param {boolean} showCheckBox
|
|
230
|
-
* @returns {JSX.Element}
|
|
231
|
-
*/
|
|
232
|
-
renderListItem(e, t, i) {
|
|
233
|
-
let s;
|
|
234
|
-
const r = e.getAttribute("title") || e.text || e.innerText;
|
|
235
|
-
return e.innerText.length > 0 ? s = n("div", { class: "label__item label__item--from-inner-html", innerHTML: e.innerHTML }) : s = n("div", { class: "label__item", innerHTML: e.text }), n("li", { class: "list__item", title: r, onMouseOver: () => {
|
|
236
|
-
this.onMouseOver(t);
|
|
237
|
-
} }, n("label", { class: "mi-label label", tabindex: "-1" }, n("input", { class: { label__checkbox: !0, "label__checkbox--hidden": !i, "mi-input": !0 }, type: "checkbox", value: t, checked: e.selected, onChange: () => this.onSelect(e) }), s));
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* Function for calculating the position of the dropdown list element.
|
|
241
|
-
*/
|
|
242
|
-
calculateDropDownPosition() {
|
|
243
|
-
this.listElement.style.bottom = null, this.listElement.style.left = null, this.listElement.style.right = null, this.listElement.style.top = null, this.listElement.style.maxHeight = null, this.listElement.style.minWidth = null;
|
|
244
|
-
const { clientWidth: e, clientHeight: t } = document.documentElement, i = this.hostElement.getBoundingClientRect(), s = this.listElement.getBoundingClientRect(), r = t - i.bottom, a = i.top, o = 580, h = 12;
|
|
245
|
-
e <= s.width || i.right - s.width < 0 && s.right > e ? (this.listElement.style.right = `${h}px`, this.listElement.style.left = `${h}px`, this.listElement.style.minWidth = "unset") : s.right > e ? (this.listElement.style.left = "unset", this.listElement.style.right = `${e - i.right}px`) : (this.listElement.style.left = `${i.left}px`, this.listElement.style.right = "unset"), a > r ? (this.listElement.style.maxHeight = `${Math.min(a, o)}px`, this.listElement.style.top = "unset", this.listElement.style.bottom = `${t - i.top}px`) : (this.listElement.style.top = `${i.bottom}px`, this.listElement.style.bottom = "unset", this.listElement.style.maxHeight = `${Math.min(r - h * 2, o)}px`);
|
|
246
|
-
}
|
|
247
|
-
get hostElement() {
|
|
248
|
-
return u(this);
|
|
249
|
-
}
|
|
250
|
-
static get watchers() {
|
|
251
|
-
return {
|
|
252
|
-
items: ["onItemsChanged"],
|
|
253
|
-
currentItems: ["onCurrentItemsChange"]
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
};
|
|
257
|
-
x.style = f;
|
|
258
|
-
export {
|
|
259
|
-
x as mi_combo_box
|
|
260
|
-
};
|