overview-components 1.0.75 → 1.0.77
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/_virtual/FileSaver.min.js +4 -0
- package/dist/_virtual/_commonjsHelpers.js +4 -0
- package/dist/assets/icons/iconGlyphs.js +680 -0
- package/dist/components/lit-attachments-tab.js +11 -7
- package/dist/components/lit-badge.js +10 -7
- package/dist/components/lit-case-variables-tab.js +23 -19
- package/dist/components/lit-chart.js +24 -21
- package/dist/components/lit-data-grid-tanstack.js +42 -37
- package/dist/components/lit-filter-modal.js +6 -2
- package/dist/components/lit-multiselect-item.js +7 -3
- package/dist/components/lit-section-tab.js +15 -11
- package/dist/components/lit-tabs-overview.js +9 -5
- package/dist/components/react-wrappers/attachments-tab.js +1 -1
- package/dist/components/react-wrappers/badge.js +1 -1
- package/dist/components/react-wrappers/button.js +3 -3
- package/dist/components/react-wrappers/case-variables-tab.js +3 -3
- package/dist/components/react-wrappers/chart.js +3 -3
- package/dist/components/react-wrappers/data-grid-tanstack.js +1 -1
- package/dist/components/react-wrappers/filter-modal.js +4 -4
- package/dist/components/react-wrappers/progress-bar.js +5 -5
- package/dist/components/react-wrappers/section-tab.js +4 -4
- package/dist/components/react-wrappers/tabs-overview.js +3 -3
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +51 -32
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +432 -0
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +390 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +131 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +128 -0
- package/dist/node_modules/@lit/localize/init/install.js +11 -0
- package/dist/node_modules/@lit/localize/init/runtime.js +42 -0
- package/dist/node_modules/@lit/localize/internal/default-msg.js +10 -0
- package/dist/node_modules/@lit/localize/internal/deferred.js +21 -0
- package/dist/node_modules/@lit/localize/internal/fnv1a64.js +17 -0
- package/dist/node_modules/@lit/localize/internal/id-generation.js +14 -0
- package/dist/node_modules/@lit/localize/internal/locale-status-event.js +9 -0
- package/dist/node_modules/@lit/localize/internal/runtime-msg.js +42 -0
- package/dist/node_modules/@lit/localize/internal/str-tag.js +15 -0
- package/dist/node_modules/@lit/react/create-component.js +35 -0
- package/dist/node_modules/@lit/reactive-element/css-tag.js +32 -24
- package/dist/node_modules/@lit/reactive-element/reactive-element.js +4 -3
- package/dist/node_modules/@tanstack/lit-table/build/lib/index.js +104 -0
- package/dist/node_modules/@tanstack/lit-virtual/dist/esm/index.js +40 -0
- package/dist/node_modules/@tanstack/table-core/build/lib/index.js +1956 -0
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/index.js +490 -0
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/utils.js +52 -0
- package/dist/node_modules/file-saver/dist/FileSaver.min.js +74 -0
- package/dist/node_modules/lit-element/lit-element.js +51 -0
- package/dist/node_modules/lit-html/directives/class-map.js +34 -0
- package/dist/node_modules/lit-html/lit-html.js +75 -74
- package/dist/node_modules/luxon/src/datetime.js +1793 -0
- package/dist/node_modules/luxon/src/duration.js +723 -0
- package/dist/node_modules/luxon/src/errors.js +40 -0
- package/dist/node_modules/luxon/src/impl/conversions.js +92 -0
- package/dist/node_modules/luxon/src/impl/diff.js +36 -0
- package/dist/node_modules/luxon/src/impl/digits.js +74 -0
- package/dist/node_modules/luxon/src/impl/english.js +138 -0
- package/dist/node_modules/luxon/src/impl/formats.js +150 -0
- package/dist/node_modules/luxon/src/impl/formatter.js +245 -0
- package/dist/node_modules/luxon/src/impl/invalid.js +11 -0
- package/dist/node_modules/luxon/src/impl/locale.js +282 -0
- package/dist/node_modules/luxon/src/impl/regexParser.js +202 -0
- package/dist/node_modules/luxon/src/impl/tokenParser.js +329 -0
- package/dist/node_modules/luxon/src/impl/util.js +206 -0
- package/dist/node_modules/luxon/src/impl/zoneUtil.js +19 -0
- package/dist/node_modules/luxon/src/info.js +180 -0
- package/dist/node_modules/luxon/src/interval.js +466 -0
- package/dist/node_modules/luxon/src/settings.js +150 -0
- package/dist/node_modules/luxon/src/zone.js +88 -0
- package/dist/node_modules/luxon/src/zones/IANAZone.js +178 -0
- package/dist/node_modules/luxon/src/zones/fixedOffsetZone.js +125 -0
- package/dist/node_modules/luxon/src/zones/invalidZone.js +41 -0
- package/dist/node_modules/luxon/src/zones/systemZone.js +47 -0
- package/dist/node_modules/sortablejs/modular/sortable.esm.js +1261 -0
- package/dist/shared/lit-button.js +11 -8
- package/dist/shared/lit-checkbox.js +155 -0
- package/dist/shared/lit-icon.js +282 -0
- package/dist/shared/lit-input.js +211 -0
- package/dist/shared/lit-menu.js +40 -0
- package/dist/shared/lit-modal.js +128 -0
- package/dist/shared/lit-pill.js +86 -0
- package/dist/shared/lit-progress-bar.js +10 -7
- package/dist/shared/lit-select.js +339 -0
- package/dist/shared/lit-tooltip.js +137 -0
- package/dist/shared/simple-tooltip.js +33 -31
- package/dist/shared/styles/button-shared-styles.js +6 -3
- package/dist/styles.js +174 -0
- package/dist/utils/custom-filters.js +8 -7
- package/dist/utils/date.js +6 -5
- package/dist/utils/getOperatorByType.js +4 -3
- package/dist/utils/localization.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import "../node_modules/@lit/reactive-element/reactive-element.js";
|
|
2
|
+
import { html as m } from "../node_modules/lit-html/lit-html.js";
|
|
3
|
+
import { LitElement as p } from "../node_modules/lit-element/lit-element.js";
|
|
4
|
+
import { customElement as a } from "../node_modules/@lit/reactive-element/decorators/custom-element.js";
|
|
5
|
+
import { css as u } from "../node_modules/@lit/reactive-element/css-tag.js";
|
|
6
|
+
var f = Object.getOwnPropertyDescriptor, c = (l, s, n, o) => {
|
|
7
|
+
for (var t = o > 1 ? void 0 : o ? f(s, n) : s, e = l.length - 1, i; e >= 0; e--)
|
|
8
|
+
(i = l[e]) && (t = i(t) || t);
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
let r = class extends p {
|
|
12
|
+
render() {
|
|
13
|
+
return m`
|
|
14
|
+
<ul>
|
|
15
|
+
<slot></slot>
|
|
16
|
+
</ul>
|
|
17
|
+
`;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
r.styles = u`
|
|
21
|
+
:host {
|
|
22
|
+
outline: none;
|
|
23
|
+
}
|
|
24
|
+
ul {
|
|
25
|
+
display: flex;
|
|
26
|
+
list-style-type: none;
|
|
27
|
+
padding: 0;
|
|
28
|
+
gap: 0.25rem;
|
|
29
|
+
width: 100%;
|
|
30
|
+
flex-direction: column;
|
|
31
|
+
margin: 0;
|
|
32
|
+
height: 100%;
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
r = c([
|
|
36
|
+
a("lit-menu")
|
|
37
|
+
], r);
|
|
38
|
+
export {
|
|
39
|
+
r as LitMenu
|
|
40
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import "../node_modules/@lit/reactive-element/reactive-element.js";
|
|
2
|
+
import { html as m } from "../node_modules/lit-html/lit-html.js";
|
|
3
|
+
import { LitElement as h } from "../node_modules/lit-element/lit-element.js";
|
|
4
|
+
import { customElement as c } from "../node_modules/@lit/reactive-element/decorators/custom-element.js";
|
|
5
|
+
import { property as s } from "../node_modules/@lit/reactive-element/decorators/property.js";
|
|
6
|
+
import { css as p } from "../node_modules/@lit/reactive-element/css-tag.js";
|
|
7
|
+
var u = Object.defineProperty, y = Object.getOwnPropertyDescriptor, n = (e, i, a, l) => {
|
|
8
|
+
for (var t = l > 1 ? void 0 : l ? y(i, a) : i, d = e.length - 1, r; d >= 0; d--)
|
|
9
|
+
(r = e[d]) && (t = (l ? r(i, a, t) : r(t)) || t);
|
|
10
|
+
return l && t && u(i, a, t), t;
|
|
11
|
+
};
|
|
12
|
+
let o = class extends h {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments), this.open = !1, this.closeOnOutsideClick = !0, this.fullScreen = !1, this._modalContainer = null, this._modalContent = null;
|
|
15
|
+
}
|
|
16
|
+
connectedCallback() {
|
|
17
|
+
super.connectedCallback(), document.addEventListener("keydown", this._handleKeyDown.bind(this));
|
|
18
|
+
}
|
|
19
|
+
disconnectedCallback() {
|
|
20
|
+
super.disconnectedCallback(), document.removeEventListener("keydown", this._handleKeyDown.bind(this));
|
|
21
|
+
}
|
|
22
|
+
updated(e) {
|
|
23
|
+
e.has("open") && (this.open ? this._showModal() : this._hideModal());
|
|
24
|
+
}
|
|
25
|
+
_handleBackdropClick() {
|
|
26
|
+
this.closeOnOutsideClick && (this.open = !1);
|
|
27
|
+
}
|
|
28
|
+
_showModal() {
|
|
29
|
+
if (!this._modalContainer) {
|
|
30
|
+
this._modalContainer = document.createElement("div"), this._modalContainer.classList.add("my-modal-root"), this._modalContainer.innerHTML = `
|
|
31
|
+
<div class="my-modal-backdrop"></div>
|
|
32
|
+
<div class="my-modal-content"></div>
|
|
33
|
+
`, document.body.appendChild(this._modalContainer);
|
|
34
|
+
const e = this._modalContainer.querySelector(".my-modal-backdrop");
|
|
35
|
+
e && e.addEventListener("click", this._handleBackdropClick.bind(this)), this._modalContent = this._modalContainer.querySelector(".my-modal-content");
|
|
36
|
+
}
|
|
37
|
+
this._modalContent && (this._updateContentClass(), this._modalContent.appendChild(this)), document.addEventListener("keydown", this._handleKeyDown), this._applyGlobalStyles();
|
|
38
|
+
}
|
|
39
|
+
_hideModal() {
|
|
40
|
+
this._modalContainer && (document.removeEventListener("keydown", this._handleKeyDown), this._modalContainer.remove(), this._modalContainer = null), typeof this.onClose == "function" && this.onClose(), this.dispatchEvent(new CustomEvent("modal-close", { bubbles: !0, composed: !0 }));
|
|
41
|
+
}
|
|
42
|
+
_handleKeyDown(e) {
|
|
43
|
+
e.key === "Escape" && (this.open = !1);
|
|
44
|
+
}
|
|
45
|
+
_updateContentClass() {
|
|
46
|
+
this._modalContent && (this.fullScreen ? this._modalContent.classList.add("fullscreen") : this._modalContent.classList.remove("fullscreen"));
|
|
47
|
+
}
|
|
48
|
+
_applyGlobalStyles() {
|
|
49
|
+
if (!document.getElementById("my-modal-global-styles")) {
|
|
50
|
+
const e = document.createElement("style");
|
|
51
|
+
e.id = "my-modal-global-styles", e.textContent = `
|
|
52
|
+
.my-modal-root {
|
|
53
|
+
position: fixed;
|
|
54
|
+
top: 0; left: 0; right: 0; bottom: 0;
|
|
55
|
+
z-index: 10000;
|
|
56
|
+
display: flex;
|
|
57
|
+
align-items: center;
|
|
58
|
+
justify-content: center;
|
|
59
|
+
}
|
|
60
|
+
.my-modal-backdrop {
|
|
61
|
+
position: absolute;
|
|
62
|
+
top: 0; left: 0; right: 0; bottom: 0;
|
|
63
|
+
background: rgba(0,0,0,0.5);
|
|
64
|
+
}
|
|
65
|
+
.my-modal-content {
|
|
66
|
+
position: relative;
|
|
67
|
+
background: var(--background-paper, #fff);
|
|
68
|
+
border-radius: 12px;
|
|
69
|
+
min-width: 40vw;
|
|
70
|
+
max-width: 90vw;
|
|
71
|
+
max-height: 90vh;
|
|
72
|
+
z-index: 1;
|
|
73
|
+
box-shadow: 0 8px 32px rgba(0,0,0,0.2);
|
|
74
|
+
display: flex;
|
|
75
|
+
flex-direction: column;
|
|
76
|
+
justify-content: center;
|
|
77
|
+
align-items: center;
|
|
78
|
+
overflow: hidden;
|
|
79
|
+
gap: 0.5rem;
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
.my-modal-content.fullscreen {
|
|
83
|
+
border-radius: 0;
|
|
84
|
+
width: 100vw;
|
|
85
|
+
height: 100vh;
|
|
86
|
+
max-width: 100vw;
|
|
87
|
+
max-height: 100vh;
|
|
88
|
+
padding: 0;
|
|
89
|
+
display: flex;
|
|
90
|
+
}
|
|
91
|
+
`, document.head.appendChild(e);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
render() {
|
|
95
|
+
return m`<slot></slot>`;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
o.styles = p`
|
|
99
|
+
:host {
|
|
100
|
+
display: none;
|
|
101
|
+
width: 100%;
|
|
102
|
+
height: 100vh;
|
|
103
|
+
@media (min-width: 768px) {
|
|
104
|
+
height: 100%;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
:host([open]) {
|
|
108
|
+
display: block;
|
|
109
|
+
}
|
|
110
|
+
`;
|
|
111
|
+
n([
|
|
112
|
+
s({ type: Boolean, reflect: !0 })
|
|
113
|
+
], o.prototype, "open", 2);
|
|
114
|
+
n([
|
|
115
|
+
s({ type: Boolean })
|
|
116
|
+
], o.prototype, "closeOnOutsideClick", 2);
|
|
117
|
+
n([
|
|
118
|
+
s({ type: Function })
|
|
119
|
+
], o.prototype, "onClose", 2);
|
|
120
|
+
n([
|
|
121
|
+
s({ type: Boolean })
|
|
122
|
+
], o.prototype, "fullScreen", 2);
|
|
123
|
+
o = n([
|
|
124
|
+
c("lit-modal")
|
|
125
|
+
], o);
|
|
126
|
+
export {
|
|
127
|
+
o as LitModal
|
|
128
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { customElement as c } from "../node_modules/@lit/reactive-element/decorators/custom-element.js";
|
|
2
|
+
import { property as d } from "../node_modules/@lit/reactive-element/decorators/property.js";
|
|
3
|
+
import "../node_modules/@lit/reactive-element/reactive-element.js";
|
|
4
|
+
import { html as a } from "../node_modules/lit-html/lit-html.js";
|
|
5
|
+
import { LitElement as m } from "../node_modules/lit-element/lit-element.js";
|
|
6
|
+
import { css as u } from "../node_modules/@lit/reactive-element/css-tag.js";
|
|
7
|
+
var f = Object.defineProperty, h = Object.getOwnPropertyDescriptor, p = (t, r, o, s) => {
|
|
8
|
+
for (var i = s > 1 ? void 0 : s ? h(r, o) : r, n = t.length - 1, l; n >= 0; n--)
|
|
9
|
+
(l = t[n]) && (i = (s ? l(r, o, i) : l(i)) || i);
|
|
10
|
+
return s && i && f(r, o, i), i;
|
|
11
|
+
};
|
|
12
|
+
let e = class extends m {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments), this.loading = !1;
|
|
15
|
+
}
|
|
16
|
+
render() {
|
|
17
|
+
const t = this.count !== void 0 && this.count !== null && this.count >= 0, r = this.loading, o = this.count && this.count < 100 ? this.count : "99+";
|
|
18
|
+
return t || r ? a`
|
|
19
|
+
<div class="pill--wrapper">
|
|
20
|
+
${t ? a` <div class="pill">${o}</div> ` : ""}
|
|
21
|
+
${r ? a` <div class="pill__loading-spinner"></div> ` : ""}
|
|
22
|
+
</div>
|
|
23
|
+
` : null;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
e.styles = [
|
|
27
|
+
// styles,
|
|
28
|
+
u`
|
|
29
|
+
.pill--wrapper {
|
|
30
|
+
display: flex;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
align-items: center;
|
|
33
|
+
height: 20px;
|
|
34
|
+
min-width: 20px;
|
|
35
|
+
background-color: var(--color-success-main, #76b703);
|
|
36
|
+
border-radius: 50px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.pill {
|
|
40
|
+
padding: 0 0.375rem;
|
|
41
|
+
font-size: 0.6875rem;
|
|
42
|
+
font-weight: 600;
|
|
43
|
+
color: white;
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
justify-content: center;
|
|
47
|
+
white-space: nowrap;
|
|
48
|
+
transition: background-color 0.3s ease;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.pill:disabled {
|
|
52
|
+
background-color: var(--color-primary-disabled, #d0d3db);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.pill__loading-spinner {
|
|
56
|
+
width: 20px;
|
|
57
|
+
height: 20px;
|
|
58
|
+
border: 2px solid var(--color-divider, #d0d3db);
|
|
59
|
+
border-top: 2px solid var(--color-primary-main, #76b703);
|
|
60
|
+
border-radius: 50%;
|
|
61
|
+
animation: spin 1s linear infinite;
|
|
62
|
+
position: absolute;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@keyframes spin {
|
|
66
|
+
0% {
|
|
67
|
+
transform: rotate(0deg);
|
|
68
|
+
}
|
|
69
|
+
100% {
|
|
70
|
+
transform: rotate(360deg);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
`
|
|
74
|
+
];
|
|
75
|
+
p([
|
|
76
|
+
d({ type: Number })
|
|
77
|
+
], e.prototype, "count", 2);
|
|
78
|
+
p([
|
|
79
|
+
d({ type: Boolean })
|
|
80
|
+
], e.prototype, "loading", 2);
|
|
81
|
+
e = p([
|
|
82
|
+
c("lit-pill")
|
|
83
|
+
], e);
|
|
84
|
+
export {
|
|
85
|
+
e as LitPill
|
|
86
|
+
};
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { customElement as c } from "../node_modules/@lit/reactive-element/decorators/custom-element.js";
|
|
2
2
|
import { property as n } from "../node_modules/@lit/reactive-element/decorators/property.js";
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import "../node_modules/@lit/reactive-element/reactive-element.js";
|
|
4
|
+
import { html as g } from "../node_modules/lit-html/lit-html.js";
|
|
5
|
+
import { LitElement as d } from "../node_modules/lit-element/lit-element.js";
|
|
6
|
+
import { css as m } from "../node_modules/@lit/reactive-element/css-tag.js";
|
|
7
|
+
var f = Object.defineProperty, v = Object.getOwnPropertyDescriptor, l = (e, t, i, o) => {
|
|
8
|
+
for (var r = o > 1 ? void 0 : o ? v(t, i) : t, a = e.length - 1, p; a >= 0; a--)
|
|
6
9
|
(p = e[a]) && (r = (o ? p(t, i, r) : p(r)) || r);
|
|
7
|
-
return o && r &&
|
|
10
|
+
return o && r && f(t, i, r), r;
|
|
8
11
|
};
|
|
9
|
-
let s = class extends
|
|
12
|
+
let s = class extends d {
|
|
10
13
|
constructor() {
|
|
11
14
|
super(...arguments), this.label = "", this.progress = 0;
|
|
12
15
|
}
|
|
13
16
|
render() {
|
|
14
17
|
const e = Math.min(100, Math.max(0, this.progress));
|
|
15
|
-
return
|
|
18
|
+
return g`
|
|
16
19
|
<div class="container">
|
|
17
20
|
<div class="label">${this.label}</div>
|
|
18
21
|
<div class="progress-bar-container">
|
|
@@ -26,7 +29,7 @@ let s = class extends g {
|
|
|
26
29
|
}
|
|
27
30
|
};
|
|
28
31
|
s.styles = [
|
|
29
|
-
|
|
32
|
+
m`
|
|
30
33
|
.container {
|
|
31
34
|
gap: 4px;
|
|
32
35
|
}
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
import "../node_modules/@lit/reactive-element/reactive-element.js";
|
|
2
|
+
import { html as c } from "../node_modules/lit-html/lit-html.js";
|
|
3
|
+
import { LitElement as d } from "../node_modules/lit-element/lit-element.js";
|
|
4
|
+
import { msg as m } from "../node_modules/@lit/localize/init/install.js";
|
|
5
|
+
import "../node_modules/@lit/localize/init/runtime.js";
|
|
6
|
+
import { classMap as u } from "../node_modules/lit-html/directives/class-map.js";
|
|
7
|
+
import { customElement as y } from "../node_modules/@lit/reactive-element/decorators/custom-element.js";
|
|
8
|
+
import { property as l } from "../node_modules/@lit/reactive-element/decorators/property.js";
|
|
9
|
+
import { state as h } from "../node_modules/@lit/reactive-element/decorators/state.js";
|
|
10
|
+
import { query as f } from "../node_modules/@lit/reactive-element/decorators/query.js";
|
|
11
|
+
import { css as v } from "../node_modules/@lit/reactive-element/css-tag.js";
|
|
12
|
+
var b = Object.defineProperty, g = Object.getOwnPropertyDescriptor, o = (e, t, r, n) => {
|
|
13
|
+
for (var i = n > 1 ? void 0 : n ? g(t, r) : t, a = e.length - 1, p; a >= 0; a--)
|
|
14
|
+
(p = e[a]) && (i = (n ? p(t, r, i) : p(i)) || i);
|
|
15
|
+
return n && i && b(t, r, i), i;
|
|
16
|
+
};
|
|
17
|
+
let s = class extends d {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments), this.id = "", this.value = "", this.options = [], this.onChange = () => {
|
|
20
|
+
}, this.multiple = !1, this.disableClearButton = !1, this.disabled = !1, this.server = !1, this.setOperator = (e) => {
|
|
21
|
+
}, this.filterOperators = [], this.isOpen = !1, this.searchQuery = null, this.selectedIndex = -1, this.typeBuffer = "", this.typeTimeout = null, this.handleOutsideClick = (e) => {
|
|
22
|
+
const t = e.composedPath();
|
|
23
|
+
!t.includes(this) && !t.some(
|
|
24
|
+
(r) => r instanceof HTMLElement && r.tagName === "SIMPLE-POPPER"
|
|
25
|
+
) && this.closePopover();
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
connectedCallback() {
|
|
29
|
+
super.connectedCallback(), this.addEventListener("focus", () => this.focus()), document.addEventListener("click", this.handleOutsideClick);
|
|
30
|
+
}
|
|
31
|
+
disconnectedCallback() {
|
|
32
|
+
super.disconnectedCallback(), this.removeEventListener("focus", () => this.focus()), document.removeEventListener("click", this.handleOutsideClick), this.closePopover();
|
|
33
|
+
}
|
|
34
|
+
firstUpdated() {
|
|
35
|
+
this.server && this.multiple && this.setOperator("isAnyOfValue");
|
|
36
|
+
}
|
|
37
|
+
async toggleCustomPopover() {
|
|
38
|
+
var e;
|
|
39
|
+
if (this.isOpen = !this.isOpen, !this.multiple) {
|
|
40
|
+
await this.updateComplete;
|
|
41
|
+
const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("input");
|
|
42
|
+
this.selectedIndex = this.options.findIndex((r) => r.value === this.value), t && (t.focus(), t.select(), this.scrollToVisible());
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
scrollToVisible() {
|
|
46
|
+
const e = document.getElementById(`${this.id}-${this.selectedIndex}`);
|
|
47
|
+
e == null || e.scrollIntoView({ block: "center" });
|
|
48
|
+
}
|
|
49
|
+
closePopover() {
|
|
50
|
+
this.isOpen = !1, this.searchQuery = null, this.selectedIndex = -1;
|
|
51
|
+
}
|
|
52
|
+
selectOption(e) {
|
|
53
|
+
if (this.selectedIndex = this.options.findIndex((t) => t.value === e), this.multiple)
|
|
54
|
+
if (Array.isArray(this.value) && this.value.includes(e))
|
|
55
|
+
this.value = this.value.filter((t) => t !== e), this.onChange(this.value);
|
|
56
|
+
else {
|
|
57
|
+
const t = [...this.value, e];
|
|
58
|
+
this.value = t, this.onChange(this.value), this.searchQuery = null;
|
|
59
|
+
}
|
|
60
|
+
else
|
|
61
|
+
this.value = String(e), this.onChange(this.value), this.closePopover();
|
|
62
|
+
}
|
|
63
|
+
clearValue(e) {
|
|
64
|
+
e.stopPropagation(), this.value = [], this.onChange([]), this.searchQuery = null;
|
|
65
|
+
}
|
|
66
|
+
handleInput(e) {
|
|
67
|
+
this.searchQuery = e.target.value, this.isOpen = !0, this.selectedIndex = -1;
|
|
68
|
+
}
|
|
69
|
+
getFilteredOptions() {
|
|
70
|
+
return this.searchQuery ? this.options.filter(
|
|
71
|
+
(e) => {
|
|
72
|
+
var t, r;
|
|
73
|
+
return ((r = e.label) == null ? void 0 : r.toLowerCase().includes(((t = this.searchQuery) == null ? void 0 : t.toLowerCase()) || "")) && (!this.multiple || !this.value.includes(e.value));
|
|
74
|
+
}
|
|
75
|
+
) : this.options;
|
|
76
|
+
}
|
|
77
|
+
async handleKeyDown(e) {
|
|
78
|
+
if (e.key === "Tab" || e.key === "Escape")
|
|
79
|
+
this.closePopover();
|
|
80
|
+
else if (e.key === "ArrowDown")
|
|
81
|
+
e.preventDefault(), this.isOpen ? this.selectedIndex = Math.min(
|
|
82
|
+
this.selectedIndex + 1,
|
|
83
|
+
this.getFilteredOptions().length - 1
|
|
84
|
+
) : this.toggleCustomPopover();
|
|
85
|
+
else if (e.key === "ArrowUp")
|
|
86
|
+
e.preventDefault(), this.isOpen || this.toggleCustomPopover(), this.selectedIndex = Math.max(this.selectedIndex - 1, 0);
|
|
87
|
+
else if (e.key === "Enter")
|
|
88
|
+
this.selectedIndex >= 0 && this.selectOption(this.getFilteredOptions()[this.selectedIndex].value);
|
|
89
|
+
else if (/^[a-z0-9]$/i.test(e.key)) {
|
|
90
|
+
this.typeBuffer += e.key.toLowerCase(), this.typeTimeout && clearTimeout(this.typeTimeout), this.typeTimeout = window.setTimeout(() => {
|
|
91
|
+
this.typeBuffer = "";
|
|
92
|
+
}, 500);
|
|
93
|
+
const t = this.options.findIndex(
|
|
94
|
+
(r) => {
|
|
95
|
+
var n;
|
|
96
|
+
return (n = r.label) == null ? void 0 : n.toLowerCase().startsWith(this.typeBuffer);
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
t !== -1 && (this.selectedIndex = t);
|
|
100
|
+
}
|
|
101
|
+
this.scrollToVisible(), this.requestUpdate();
|
|
102
|
+
}
|
|
103
|
+
focus() {
|
|
104
|
+
var t;
|
|
105
|
+
const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector("input");
|
|
106
|
+
e == null || e.focus();
|
|
107
|
+
}
|
|
108
|
+
_isTrulyEmpty(e) {
|
|
109
|
+
return e == null ? !0 : typeof e == "string" || Array.isArray(e) ? e.length === 0 : typeof e == "object" ? Object.keys(e).length === 0 : !1;
|
|
110
|
+
}
|
|
111
|
+
render() {
|
|
112
|
+
var n;
|
|
113
|
+
const e = this.multiple ? this.options : this.getFilteredOptions(), t = {
|
|
114
|
+
"dropdown-icon": !0,
|
|
115
|
+
"dropdown-icon--rotate": this.isOpen,
|
|
116
|
+
"dropdown-icon--no-filter": !this.server || this.server && this.multiple
|
|
117
|
+
}, r = this._isTrulyEmpty(this.value) ? "" : Array.isArray(this.value) ? this.value.map((i) => {
|
|
118
|
+
var a;
|
|
119
|
+
return ((a = this.options.find((p) => p.value == i)) == null ? void 0 : a.label) || i;
|
|
120
|
+
}).join(", ") : ((n = this.options.find((i) => i.value == this.value)) == null ? void 0 : n.label) || "";
|
|
121
|
+
return c`
|
|
122
|
+
<div class="custom-icon-wrapper" slot="reference">
|
|
123
|
+
<input
|
|
124
|
+
?readonly=${this.multiple}
|
|
125
|
+
type="text"
|
|
126
|
+
.value="${this.searchQuery ?? r ?? ""}"
|
|
127
|
+
@input=${this.handleInput}
|
|
128
|
+
@click="${this.toggleCustomPopover}"
|
|
129
|
+
@keydown=${this.handleKeyDown}
|
|
130
|
+
.disabled="${this.disabled}"
|
|
131
|
+
/>
|
|
132
|
+
${!this._isTrulyEmpty(this.value) && !this.disableClearButton ? c`
|
|
133
|
+
<div
|
|
134
|
+
class=${u({
|
|
135
|
+
"custom-icon": !0,
|
|
136
|
+
"custom-icon--no-filter": !this.server || this.server && this.multiple
|
|
137
|
+
// Trieda ak filter nie je
|
|
138
|
+
})}
|
|
139
|
+
@click="${this.clearValue}"
|
|
140
|
+
>
|
|
141
|
+
<lit-icon-button
|
|
142
|
+
icon="close"
|
|
143
|
+
size="small"
|
|
144
|
+
variant="text"
|
|
145
|
+
></lit-icon-button>
|
|
146
|
+
</div>
|
|
147
|
+
` : ""}
|
|
148
|
+
<div class="${u(t)}">
|
|
149
|
+
<lit-icon
|
|
150
|
+
class="${this.disabled ? "dropdown-icon-disabled" : null}"
|
|
151
|
+
icon="chevrondown"
|
|
152
|
+
size="17px"
|
|
153
|
+
></lit-icon>
|
|
154
|
+
</div>
|
|
155
|
+
${this.server && !this.multiple ? c`<lit-data-grid-operators-popover
|
|
156
|
+
class="filter-icon"
|
|
157
|
+
.type="${this.multiple ? "multiselect" : "select"}"
|
|
158
|
+
.setOperator="${(i) => {
|
|
159
|
+
this.setOperator(i);
|
|
160
|
+
}}"
|
|
161
|
+
.operator="${this.operator}"
|
|
162
|
+
.disabled="${this.disabled}"
|
|
163
|
+
.filterOperators="${this.filterOperators}"
|
|
164
|
+
></lit-data-grid-operators-popover>` : null}
|
|
165
|
+
</div>
|
|
166
|
+
<simple-popper
|
|
167
|
+
.showing=${this.isOpen}
|
|
168
|
+
placement="bottom-start"
|
|
169
|
+
@close="${this.closePopover}"
|
|
170
|
+
manualOpening=${!0}
|
|
171
|
+
maxWidthAsTarget=${!0}
|
|
172
|
+
@keydown=${this.handleKeyDown}
|
|
173
|
+
>
|
|
174
|
+
<lit-menu tabindex="0" id="menu">
|
|
175
|
+
${(e == null ? void 0 : e.length) === 0 ? c`<lit-menu-item disabledButtons=${!0}>
|
|
176
|
+
${m("Nenalezeno")}</lit-menu-item
|
|
177
|
+
> ` : e == null ? void 0 : e.map((i, a) => {
|
|
178
|
+
const p = Array.isArray(this.value) ? this.value.includes(i.value) : this.value === i.value;
|
|
179
|
+
return c`
|
|
180
|
+
<lit-menu-item
|
|
181
|
+
id="${this.id}-${a}"
|
|
182
|
+
.isActive=${this.selectedIndex === a || p && !this.multiple}
|
|
183
|
+
.onClick="${() => this.selectOption(i.value)}"
|
|
184
|
+
>
|
|
185
|
+
<span class="menu-item--multiple">
|
|
186
|
+
${this.multiple ? c`<lit-checkbox
|
|
187
|
+
class="cursor"
|
|
188
|
+
.checked=${p}
|
|
189
|
+
></lit-checkbox>` : ""}
|
|
190
|
+
${i.label}
|
|
191
|
+
</span>
|
|
192
|
+
</lit-menu-item>
|
|
193
|
+
`;
|
|
194
|
+
})}
|
|
195
|
+
</lit-menu>
|
|
196
|
+
</simple-popper>
|
|
197
|
+
`;
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
s.styles = v`
|
|
201
|
+
.custom-icon-wrapper {
|
|
202
|
+
position: relative;
|
|
203
|
+
width: 100%;
|
|
204
|
+
display: inline-block;
|
|
205
|
+
color: var(--text-primary, #111827);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
input {
|
|
209
|
+
padding: 0.5rem;
|
|
210
|
+
border: 0.0625rem solid var(--color-divider, #d0d3db);
|
|
211
|
+
border-radius: 0.25rem;
|
|
212
|
+
min-width: 70px;
|
|
213
|
+
width: -webkit-fill-available;
|
|
214
|
+
width: -moz-available;
|
|
215
|
+
width: fill-available;
|
|
216
|
+
background-color: var(--background-paper, #fff);
|
|
217
|
+
color: var(--text-primary, #111827);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
input:hover {
|
|
221
|
+
border: 0.0625rem solid var(--color-secondary-main, #111827);
|
|
222
|
+
cursor: pointer;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
input:disabled {
|
|
226
|
+
cursor: inherit;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
input:focus {
|
|
230
|
+
outline: none;
|
|
231
|
+
border: 0.0625rem solid var(--color-secondary-dark, #010204);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.custom-icon-wrapper:hover .custom-icon {
|
|
235
|
+
display: inline-block;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.custom-icon-wrapper .custom-icon {
|
|
239
|
+
display: none;
|
|
240
|
+
position: absolute;
|
|
241
|
+
right: 51px;
|
|
242
|
+
top: 50%;
|
|
243
|
+
transform: translateY(-50%);
|
|
244
|
+
cursor: pointer;
|
|
245
|
+
pointer-events: auto;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.custom-icon-wrapper .custom-icon--no-filter {
|
|
249
|
+
right: 27px;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.custom-icon-wrapper .filter-icon {
|
|
253
|
+
display: block;
|
|
254
|
+
position: absolute;
|
|
255
|
+
right: 10px;
|
|
256
|
+
top: 50%;
|
|
257
|
+
transform: translateY(-50%);
|
|
258
|
+
cursor: pointer;
|
|
259
|
+
pointer-events: auto;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.custom-icon-wrapper .dropdown-icon {
|
|
263
|
+
position: absolute;
|
|
264
|
+
right: 34px;
|
|
265
|
+
top: 50%;
|
|
266
|
+
transform: translateY(-50%);
|
|
267
|
+
pointer-events: none;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.custom-icon-wrapper .dropdown-icon--no-filter {
|
|
271
|
+
right: 10px;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.custom-icon-wrapper .dropdown-icon--rotate {
|
|
275
|
+
transform: translateY(-55%) rotate(180deg);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.dropdown-icon-disabled {
|
|
279
|
+
background: #f8f8f8;
|
|
280
|
+
color: #5d6371;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.menu-item--multiple {
|
|
284
|
+
display: flex;
|
|
285
|
+
align-items: center;
|
|
286
|
+
}
|
|
287
|
+
`;
|
|
288
|
+
o([
|
|
289
|
+
l({ type: String })
|
|
290
|
+
], s.prototype, "id", 2);
|
|
291
|
+
o([
|
|
292
|
+
l({ type: Array })
|
|
293
|
+
], s.prototype, "value", 2);
|
|
294
|
+
o([
|
|
295
|
+
l({ type: Array })
|
|
296
|
+
], s.prototype, "options", 2);
|
|
297
|
+
o([
|
|
298
|
+
l({ type: Function })
|
|
299
|
+
], s.prototype, "onChange", 2);
|
|
300
|
+
o([
|
|
301
|
+
l({ type: Boolean })
|
|
302
|
+
], s.prototype, "multiple", 2);
|
|
303
|
+
o([
|
|
304
|
+
l({ type: Boolean })
|
|
305
|
+
], s.prototype, "disableClearButton", 2);
|
|
306
|
+
o([
|
|
307
|
+
l({ type: Boolean })
|
|
308
|
+
], s.prototype, "disabled", 2);
|
|
309
|
+
o([
|
|
310
|
+
l({ type: Boolean })
|
|
311
|
+
], s.prototype, "server", 2);
|
|
312
|
+
o([
|
|
313
|
+
l({ type: String })
|
|
314
|
+
], s.prototype, "operator", 2);
|
|
315
|
+
o([
|
|
316
|
+
l({ type: Function })
|
|
317
|
+
], s.prototype, "setOperator", 2);
|
|
318
|
+
o([
|
|
319
|
+
l({ type: Array })
|
|
320
|
+
], s.prototype, "filterOperators", 2);
|
|
321
|
+
o([
|
|
322
|
+
l({ reflect: !0, type: Boolean }),
|
|
323
|
+
h()
|
|
324
|
+
], s.prototype, "isOpen", 2);
|
|
325
|
+
o([
|
|
326
|
+
h()
|
|
327
|
+
], s.prototype, "searchQuery", 2);
|
|
328
|
+
o([
|
|
329
|
+
h()
|
|
330
|
+
], s.prototype, "selectedIndex", 2);
|
|
331
|
+
o([
|
|
332
|
+
f("#menu")
|
|
333
|
+
], s.prototype, "menu", 2);
|
|
334
|
+
s = o([
|
|
335
|
+
y("lit-select")
|
|
336
|
+
], s);
|
|
337
|
+
export {
|
|
338
|
+
s as LitSelect
|
|
339
|
+
};
|