@mhmo91/schmancy 0.2.120 → 0.2.122
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/card.cjs +1 -1
- package/dist/card.js +1 -1
- package/dist/{checkbox-CglGRaSJ.js → checkbox-4y1DGu22.js} +7 -6
- package/dist/{checkbox-CglGRaSJ.js.map → checkbox-4y1DGu22.js.map} +1 -1
- package/dist/{checkbox-Bw98L4cT.cjs → checkbox-BfFsbs3h.cjs} +6 -6
- package/dist/{checkbox-Bw98L4cT.cjs.map → checkbox-BfFsbs3h.cjs.map} +1 -1
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/{chips-BepHO_mm.cjs → chips-C6a7NyzB.cjs} +16 -16
- package/dist/{chips-BepHO_mm.cjs.map → chips-C6a7NyzB.cjs.map} +1 -1
- package/dist/{chips-C_7K0qF3.js → chips-DqXt-vj6.js} +14 -13
- package/dist/{chips-C_7K0qF3.js.map → chips-DqXt-vj6.js.map} +1 -1
- package/dist/chips.cjs +1 -1
- package/dist/chips.js +1 -1
- package/dist/content-drawer.cjs +1 -1
- package/dist/content-drawer.js +1 -1
- package/dist/flow-B1wMqea2.js +342 -0
- package/dist/flow-B1wMqea2.js.map +1 -0
- package/dist/flow-CnJl1T1A.cjs +2 -0
- package/dist/flow-CnJl1T1A.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +6 -6
- package/dist/{input-BDXWcxNw.cjs → input-C6lDXLTK.cjs} +3 -3
- package/dist/{input-BDXWcxNw.cjs.map → input-C6lDXLTK.cjs.map} +1 -1
- package/dist/{input-fP8EqcLF.js → input-DHTDgJjW.js} +64 -64
- package/dist/{input-fP8EqcLF.js.map → input-DHTDgJjW.js.map} +1 -1
- package/dist/input.cjs +1 -1
- package/dist/input.js +1 -1
- package/dist/nav-drawer.cjs +1 -1
- package/dist/nav-drawer.js +1 -1
- package/dist/{redispatch-event-vOGO-T8W.js → redispatch-event-CF5ekzwZ.js} +33 -39
- package/dist/redispatch-event-CF5ekzwZ.js.map +1 -0
- package/dist/redispatch-event-roczetCU.cjs +4 -0
- package/dist/redispatch-event-roczetCU.cjs.map +1 -0
- package/dist/table-C8Lqlb9G.js +556 -0
- package/dist/table-C8Lqlb9G.js.map +1 -0
- package/dist/table-lUgP7-kl.cjs +80 -0
- package/dist/table-lUgP7-kl.cjs.map +1 -0
- package/dist/table.cjs +1 -1
- package/dist/table.js +1 -1
- package/dist/teleport.cjs +1 -1
- package/dist/{teleport.component-CCf1dH9g.js → teleport.component-BaG47RHC.js} +21 -21
- package/dist/{teleport.component-CCf1dH9g.js.map → teleport.component-BaG47RHC.js.map} +1 -1
- package/dist/{teleport.component-n3DU71bR.cjs → teleport.component-CUyHjYuS.cjs} +2 -2
- package/dist/{teleport.component-n3DU71bR.cjs.map → teleport.component-CUyHjYuS.cjs.map} +1 -1
- package/dist/teleport.js +1 -1
- package/dist/tslib.es6-DgOcxv4s.cjs +2 -0
- package/dist/tslib.es6-DgOcxv4s.cjs.map +1 -0
- package/dist/tslib.es6-ujVQHAQ4.js +10 -0
- package/dist/tslib.es6-ujVQHAQ4.js.map +1 -0
- package/dist/{typewriter-DB08jO4e.js → typewriter-FTQ_LV70.js} +8 -8
- package/dist/{typewriter-DB08jO4e.js.map → typewriter-FTQ_LV70.js.map} +1 -1
- package/dist/typewriter.js +1 -1
- package/package.json +1 -1
- package/types/src/table/table.d.ts +1 -0
- package/dist/redispatch-event-vOGO-T8W.js.map +0 -1
- package/dist/redispatch-event-yBlefmeU.cjs +0 -4
- package/dist/redispatch-event-yBlefmeU.cjs.map +0 -1
- package/dist/table-CUgn9BYP.cjs +0 -80
- package/dist/table-CUgn9BYP.cjs.map +0 -1
- package/dist/table-k-u5jZrL.js +0 -129
- package/dist/table-k-u5jZrL.js.map +0 -1
|
@@ -0,0 +1,556 @@
|
|
|
1
|
+
import { _ as g } from "./tslib.es6-ujVQHAQ4.js";
|
|
2
|
+
import { css as H, html as d, noChange as D, LitElement as W } from "lit";
|
|
3
|
+
import { property as f } from "lit/decorators/property.js";
|
|
4
|
+
import { directive as q, PartType as U } from "lit/directive.js";
|
|
5
|
+
import { AsyncDirective as G } from "lit/async-directive.js";
|
|
6
|
+
import { repeat as L } from "lit/directives/repeat.js";
|
|
7
|
+
import { $ as R } from "./litElement.mixin-CtugwVVz.js";
|
|
8
|
+
import { property as c, customElement as M } from "lit/decorators.js";
|
|
9
|
+
var J = Object.defineProperty, X = Object.getOwnPropertyDescriptor, v = (s, t, e, i) => {
|
|
10
|
+
for (var l, r = i > 1 ? void 0 : i ? X(t, e) : t, o = s.length - 1; o >= 0; o--) (l = s[o]) && (r = (i ? l(t, e, r) : l(r)) || r);
|
|
11
|
+
return i && r && J(t, e, r), r;
|
|
12
|
+
};
|
|
13
|
+
let m = class extends R(H`
|
|
14
|
+
:host {
|
|
15
|
+
display: block;
|
|
16
|
+
z-index: -1;
|
|
17
|
+
}
|
|
18
|
+
`) {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments), this.columns = [], this.cols = "1fr";
|
|
21
|
+
}
|
|
22
|
+
render() {
|
|
23
|
+
return d`
|
|
24
|
+
<schmancy-list-item
|
|
25
|
+
@click=${() => {
|
|
26
|
+
this.dispatchEvent(new CustomEvent("row-click", { detail: this.item, bubbles: !0, composed: !0 }));
|
|
27
|
+
}}
|
|
28
|
+
class="w-full"
|
|
29
|
+
>
|
|
30
|
+
<schmancy-grid .cols=${this.cols} align="center" gap="md">
|
|
31
|
+
${this.columns.map((s) => {
|
|
32
|
+
var t;
|
|
33
|
+
return d`
|
|
34
|
+
<div class="overflow-hidden text-ellipsis">
|
|
35
|
+
<schmancy-typography
|
|
36
|
+
align="${s.align || "left"}"
|
|
37
|
+
maxLines="2"
|
|
38
|
+
weight="${s.weight || "normal"}"
|
|
39
|
+
>
|
|
40
|
+
${s.render ? s.render(this.item) : s.key ? (t = this.item) == null ? void 0 : t[s.key] : ""}
|
|
41
|
+
</schmancy-typography>
|
|
42
|
+
</div>
|
|
43
|
+
`;
|
|
44
|
+
})}
|
|
45
|
+
<sch-flex
|
|
46
|
+
class="min-w-fit block"
|
|
47
|
+
flow="row-dense"
|
|
48
|
+
.hidden=${Array.isArray(this.actions) && this.actions.length === 0}
|
|
49
|
+
>
|
|
50
|
+
${L(this.actions ?? [], ({ name: s }) => s, ({ name: s, action: t }) => d`
|
|
51
|
+
<schmancy-icon-button
|
|
52
|
+
@click=${(e) => {
|
|
53
|
+
e.stopPropagation(), t(this.item);
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
${s}
|
|
57
|
+
</schmancy-icon-button>
|
|
58
|
+
`)}
|
|
59
|
+
</sch-flex>
|
|
60
|
+
<!-- <schmancy-menu .hidden=${Array.isArray(this.actions) && this.actions.length === 0}>
|
|
61
|
+
${L(this.actions ?? [], ({ name: s }) => s, ({ name: s, action: t }) => d`
|
|
62
|
+
<schmancy-menu-item
|
|
63
|
+
class="z-[10000]"
|
|
64
|
+
@click=${(e) => {
|
|
65
|
+
e.stopPropagation(), t(this.item);
|
|
66
|
+
}}
|
|
67
|
+
>
|
|
68
|
+
${s}
|
|
69
|
+
</schmancy-menu-item>
|
|
70
|
+
`)}
|
|
71
|
+
</schmancy-menu> -->
|
|
72
|
+
</schmancy-grid>
|
|
73
|
+
</schmancy-list-item>
|
|
74
|
+
`;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
v([c({ type: Array, attribute: !1 })], m.prototype, "columns", 2), v([c({ type: Object, attribute: !1 })], m.prototype, "item", 2), v([c({ type: String })], m.prototype, "cols", 2), v([c({ type: Array })], m.prototype, "actions", 2), m = v([M("schmancy-table-row")], m);
|
|
78
|
+
class C extends Event {
|
|
79
|
+
constructor(t) {
|
|
80
|
+
super(C.eventName, { bubbles: !1 }), this.first = t.first, this.last = t.last;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
C.eventName = "rangeChanged";
|
|
84
|
+
class E extends Event {
|
|
85
|
+
constructor(t) {
|
|
86
|
+
super(E.eventName, { bubbles: !1 }), this.first = t.first, this.last = t.last;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
E.eventName = "visibilityChanged";
|
|
90
|
+
class S extends Event {
|
|
91
|
+
constructor() {
|
|
92
|
+
super(S.eventName, { bubbles: !1 });
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
S.eventName = "unpinned";
|
|
96
|
+
class Y {
|
|
97
|
+
constructor(t) {
|
|
98
|
+
this._element = null;
|
|
99
|
+
const e = t ?? window;
|
|
100
|
+
this._node = e, t && (this._element = t);
|
|
101
|
+
}
|
|
102
|
+
get element() {
|
|
103
|
+
return this._element || document.scrollingElement || document.documentElement;
|
|
104
|
+
}
|
|
105
|
+
get scrollTop() {
|
|
106
|
+
return this.element.scrollTop || window.scrollY;
|
|
107
|
+
}
|
|
108
|
+
get scrollLeft() {
|
|
109
|
+
return this.element.scrollLeft || window.scrollX;
|
|
110
|
+
}
|
|
111
|
+
get scrollHeight() {
|
|
112
|
+
return this.element.scrollHeight;
|
|
113
|
+
}
|
|
114
|
+
get scrollWidth() {
|
|
115
|
+
return this.element.scrollWidth;
|
|
116
|
+
}
|
|
117
|
+
get viewportHeight() {
|
|
118
|
+
return this._element ? this._element.getBoundingClientRect().height : window.innerHeight;
|
|
119
|
+
}
|
|
120
|
+
get viewportWidth() {
|
|
121
|
+
return this._element ? this._element.getBoundingClientRect().width : window.innerWidth;
|
|
122
|
+
}
|
|
123
|
+
get maxScrollTop() {
|
|
124
|
+
return this.scrollHeight - this.viewportHeight;
|
|
125
|
+
}
|
|
126
|
+
get maxScrollLeft() {
|
|
127
|
+
return this.scrollWidth - this.viewportWidth;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
class K extends Y {
|
|
131
|
+
constructor(t, e) {
|
|
132
|
+
super(e), this._clients = /* @__PURE__ */ new Set(), this._retarget = null, this._end = null, this.t = null, this.correctingScrollError = !1, this._checkForArrival = this._checkForArrival.bind(this), this._updateManagedScrollTo = this._updateManagedScrollTo.bind(this), this.scrollTo = this.scrollTo.bind(this), this.scrollBy = this.scrollBy.bind(this);
|
|
133
|
+
const i = this._node;
|
|
134
|
+
this._originalScrollTo = i.scrollTo, this._originalScrollBy = i.scrollBy, this._originalScroll = i.scroll, this._attach(t);
|
|
135
|
+
}
|
|
136
|
+
get _destination() {
|
|
137
|
+
return this.t;
|
|
138
|
+
}
|
|
139
|
+
get scrolling() {
|
|
140
|
+
return this._destination !== null;
|
|
141
|
+
}
|
|
142
|
+
scrollTo(t, e) {
|
|
143
|
+
const i = typeof t == "number" && typeof e == "number" ? { left: t, top: e } : t;
|
|
144
|
+
this._scrollTo(i);
|
|
145
|
+
}
|
|
146
|
+
scrollBy(t, e) {
|
|
147
|
+
const i = typeof t == "number" && typeof e == "number" ? { left: t, top: e } : t;
|
|
148
|
+
i.top !== void 0 && (i.top += this.scrollTop), i.left !== void 0 && (i.left += this.scrollLeft), this._scrollTo(i);
|
|
149
|
+
}
|
|
150
|
+
_nativeScrollTo(t) {
|
|
151
|
+
this._originalScrollTo.bind(this._element || window)(t);
|
|
152
|
+
}
|
|
153
|
+
_scrollTo(t, e = null, i = null) {
|
|
154
|
+
this._end !== null && this._end(), t.behavior === "smooth" ? (this._setDestination(t), this._retarget = e, this._end = i) : this._resetScrollState(), this._nativeScrollTo(t);
|
|
155
|
+
}
|
|
156
|
+
_setDestination(t) {
|
|
157
|
+
let { top: e, left: i } = t;
|
|
158
|
+
return e = e === void 0 ? void 0 : Math.max(0, Math.min(e, this.maxScrollTop)), i = i === void 0 ? void 0 : Math.max(0, Math.min(i, this.maxScrollLeft)), (this._destination === null || i !== this._destination.left || e !== this._destination.top) && (this.t = { top: e, left: i, behavior: "smooth" }, !0);
|
|
159
|
+
}
|
|
160
|
+
_resetScrollState() {
|
|
161
|
+
this.t = null, this._retarget = null, this._end = null;
|
|
162
|
+
}
|
|
163
|
+
_updateManagedScrollTo(t) {
|
|
164
|
+
this._destination && this._setDestination(t) && this._nativeScrollTo(this._destination);
|
|
165
|
+
}
|
|
166
|
+
managedScrollTo(t, e, i) {
|
|
167
|
+
return this._scrollTo(t, e, i), this._updateManagedScrollTo;
|
|
168
|
+
}
|
|
169
|
+
correctScrollError(t) {
|
|
170
|
+
this.correctingScrollError = !0, requestAnimationFrame(() => requestAnimationFrame(() => this.correctingScrollError = !1)), this._nativeScrollTo(t), this._retarget && this._setDestination(this._retarget()), this._destination && this._nativeScrollTo(this._destination);
|
|
171
|
+
}
|
|
172
|
+
_checkForArrival() {
|
|
173
|
+
if (this._destination !== null) {
|
|
174
|
+
const { scrollTop: t, scrollLeft: e } = this;
|
|
175
|
+
let { top: i, left: l } = this._destination;
|
|
176
|
+
i = Math.min(i || 0, this.maxScrollTop), l = Math.min(l || 0, this.maxScrollLeft);
|
|
177
|
+
const r = Math.abs(i - t), o = Math.abs(l - e);
|
|
178
|
+
r < 1 && o < 1 && (this._end && this._end(), this._resetScrollState());
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
detach(t) {
|
|
182
|
+
return this._clients.delete(t), this._clients.size === 0 && (this._node.scrollTo = this._originalScrollTo, this._node.scrollBy = this._originalScrollBy, this._node.scroll = this._originalScroll, this._node.removeEventListener("scroll", this._checkForArrival)), null;
|
|
183
|
+
}
|
|
184
|
+
_attach(t) {
|
|
185
|
+
this._clients.add(t), this._clients.size === 1 && (this._node.scrollTo = this.scrollTo, this._node.scrollBy = this.scrollBy, this._node.scroll = this.scrollTo, this._node.addEventListener("scroll", this._checkForArrival));
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
let k = typeof window < "u" ? window.ResizeObserver : void 0;
|
|
189
|
+
const z = Symbol("virtualizerRef"), b = "virtualizer-sizer";
|
|
190
|
+
let O;
|
|
191
|
+
class Q {
|
|
192
|
+
constructor(t) {
|
|
193
|
+
if (this._benchmarkStart = null, this._layout = null, this._clippingAncestors = [], this._scrollSize = null, this._scrollError = null, this._childrenPos = null, this._childMeasurements = null, this._toBeMeasured = /* @__PURE__ */ new Map(), this._rangeChanged = !0, this._itemsChanged = !0, this._visibilityChanged = !0, this._scrollerController = null, this._isScroller = !1, this._sizer = null, this._hostElementRO = null, this._childrenRO = null, this._mutationObserver = null, this._scrollEventListeners = [], this._scrollEventListenerOptions = { passive: !0 }, this._loadListener = this._childLoaded.bind(this), this._scrollIntoViewTarget = null, this._updateScrollIntoViewCoordinates = null, this._items = [], this._first = -1, this._last = -1, this._firstVisible = -1, this._lastVisible = -1, this._scheduled = /* @__PURE__ */ new WeakSet(), this._measureCallback = null, this._measureChildOverride = null, this._layoutCompletePromise = null, this._layoutCompleteResolver = null, this._layoutCompleteRejecter = null, this._pendingLayoutComplete = null, this._layoutInitialized = null, this._connected = !1, !t) throw new Error("Virtualizer constructor requires a configuration object");
|
|
194
|
+
if (!t.hostElement) throw new Error('Virtualizer configuration requires the "hostElement" property');
|
|
195
|
+
this._init(t);
|
|
196
|
+
}
|
|
197
|
+
set items(t) {
|
|
198
|
+
Array.isArray(t) && t !== this._items && (this._itemsChanged = !0, this._items = t, this._schedule(this._updateLayout));
|
|
199
|
+
}
|
|
200
|
+
_init(t) {
|
|
201
|
+
this._isScroller = !!t.scroller, this._initHostElement(t);
|
|
202
|
+
const e = t.layout || {};
|
|
203
|
+
this._layoutInitialized = this._initLayout(e);
|
|
204
|
+
}
|
|
205
|
+
_initObservers() {
|
|
206
|
+
this._mutationObserver = new MutationObserver(this._finishDOMUpdate.bind(this)), this._hostElementRO = new k(() => this._hostElementSizeChanged()), this._childrenRO = new k(this._childrenSizeChanged.bind(this));
|
|
207
|
+
}
|
|
208
|
+
_initHostElement(t) {
|
|
209
|
+
const e = this._hostElement = t.hostElement;
|
|
210
|
+
this._applyVirtualizerStyles(), e[z] = this;
|
|
211
|
+
}
|
|
212
|
+
connected() {
|
|
213
|
+
this._initObservers();
|
|
214
|
+
const t = this._isScroller;
|
|
215
|
+
this._clippingAncestors = function(e, i = !1) {
|
|
216
|
+
let l = !1;
|
|
217
|
+
return function(r, o = !1) {
|
|
218
|
+
const a = [];
|
|
219
|
+
let h = o ? r : V(r);
|
|
220
|
+
for (; h !== null; ) a.push(h), h = V(h);
|
|
221
|
+
return a;
|
|
222
|
+
}(e, i).filter((r) => {
|
|
223
|
+
if (l) return !1;
|
|
224
|
+
const o = getComputedStyle(r);
|
|
225
|
+
return l = o.position === "fixed", o.overflow !== "visible";
|
|
226
|
+
});
|
|
227
|
+
}(this._hostElement, t), this._scrollerController = new K(this, this._clippingAncestors[0]), this._schedule(this._updateLayout), this._observeAndListen(), this._connected = !0;
|
|
228
|
+
}
|
|
229
|
+
_observeAndListen() {
|
|
230
|
+
this._mutationObserver.observe(this._hostElement, { childList: !0 }), this._hostElementRO.observe(this._hostElement), this._scrollEventListeners.push(window), window.addEventListener("scroll", this, this._scrollEventListenerOptions), this._clippingAncestors.forEach((t) => {
|
|
231
|
+
t.addEventListener("scroll", this, this._scrollEventListenerOptions), this._scrollEventListeners.push(t), this._hostElementRO.observe(t);
|
|
232
|
+
}), this._hostElementRO.observe(this._scrollerController.element), this._children.forEach((t) => this._childrenRO.observe(t)), this._scrollEventListeners.forEach((t) => t.addEventListener("scroll", this, this._scrollEventListenerOptions));
|
|
233
|
+
}
|
|
234
|
+
disconnected() {
|
|
235
|
+
var t, e, i, l;
|
|
236
|
+
this._scrollEventListeners.forEach((r) => r.removeEventListener("scroll", this, this._scrollEventListenerOptions)), this._scrollEventListeners = [], this._clippingAncestors = [], (t = this._scrollerController) == null || t.detach(this), this._scrollerController = null, (e = this._mutationObserver) == null || e.disconnect(), this._mutationObserver = null, (i = this._hostElementRO) == null || i.disconnect(), this._hostElementRO = null, (l = this._childrenRO) == null || l.disconnect(), this._childrenRO = null, this._rejectLayoutCompletePromise("disconnected"), this._connected = !1;
|
|
237
|
+
}
|
|
238
|
+
_applyVirtualizerStyles() {
|
|
239
|
+
const t = this._hostElement.style;
|
|
240
|
+
t.display = t.display || "block", t.position = t.position || "relative", t.contain = t.contain || "size layout", this._isScroller && (t.overflow = t.overflow || "auto", t.minHeight = t.minHeight || "150px");
|
|
241
|
+
}
|
|
242
|
+
_getSizer() {
|
|
243
|
+
const t = this._hostElement;
|
|
244
|
+
if (!this._sizer) {
|
|
245
|
+
let e = t.querySelector(`[${b}]`);
|
|
246
|
+
e || (e = document.createElement("div"), e.setAttribute(b, ""), t.appendChild(e)), Object.assign(e.style, { position: "absolute", margin: "-2px 0 0 0", padding: 0, visibility: "hidden", fontSize: "2px" }), e.textContent = " ", e.setAttribute(b, ""), this._sizer = e;
|
|
247
|
+
}
|
|
248
|
+
return this._sizer;
|
|
249
|
+
}
|
|
250
|
+
async updateLayoutConfig(t) {
|
|
251
|
+
await this._layoutInitialized;
|
|
252
|
+
const e = t.type || O;
|
|
253
|
+
if (typeof e == "function" && this._layout instanceof e) {
|
|
254
|
+
const i = { ...t };
|
|
255
|
+
return delete i.type, this._layout.config = i, !0;
|
|
256
|
+
}
|
|
257
|
+
return !1;
|
|
258
|
+
}
|
|
259
|
+
async _initLayout(t) {
|
|
260
|
+
let e, i;
|
|
261
|
+
if (typeof t.type == "function") {
|
|
262
|
+
i = t.type;
|
|
263
|
+
const l = { ...t };
|
|
264
|
+
delete l.type, e = l;
|
|
265
|
+
} else e = t;
|
|
266
|
+
i === void 0 && (O = i = (await import("./flow-B1wMqea2.js")).FlowLayout), this._layout = new i((l) => this._handleLayoutMessage(l), e), this._layout.measureChildren && typeof this._layout.updateItemSizes == "function" && (typeof this._layout.measureChildren == "function" && (this._measureChildOverride = this._layout.measureChildren), this._measureCallback = this._layout.updateItemSizes.bind(this._layout)), this._layout.listenForChildLoadEvents && this._hostElement.addEventListener("load", this._loadListener, !0), this._schedule(this._updateLayout);
|
|
267
|
+
}
|
|
268
|
+
startBenchmarking() {
|
|
269
|
+
this._benchmarkStart === null && (this._benchmarkStart = window.performance.now());
|
|
270
|
+
}
|
|
271
|
+
stopBenchmarking() {
|
|
272
|
+
if (this._benchmarkStart !== null) {
|
|
273
|
+
const t = window.performance.now(), e = t - this._benchmarkStart, i = performance.getEntriesByName("uv-virtualizing", "measure").filter((l) => l.startTime >= this._benchmarkStart && l.startTime < t).reduce((l, r) => l + r.duration, 0);
|
|
274
|
+
return this._benchmarkStart = null, { timeElapsed: e, virtualizationTime: i };
|
|
275
|
+
}
|
|
276
|
+
return null;
|
|
277
|
+
}
|
|
278
|
+
_measureChildren() {
|
|
279
|
+
const t = {}, e = this._children, i = this._measureChildOverride || this._measureChild;
|
|
280
|
+
for (let l = 0; l < e.length; l++) {
|
|
281
|
+
const r = e[l], o = this._first + l;
|
|
282
|
+
(this._itemsChanged || this._toBeMeasured.has(r)) && (t[o] = i.call(this, r, this._items[o]));
|
|
283
|
+
}
|
|
284
|
+
this._childMeasurements = t, this._schedule(this._updateLayout), this._toBeMeasured.clear();
|
|
285
|
+
}
|
|
286
|
+
_measureChild(t) {
|
|
287
|
+
const { width: e, height: i } = t.getBoundingClientRect();
|
|
288
|
+
return Object.assign({ width: e, height: i }, function(l) {
|
|
289
|
+
const r = window.getComputedStyle(l);
|
|
290
|
+
return { marginTop: w(r.marginTop), marginRight: w(r.marginRight), marginBottom: w(r.marginBottom), marginLeft: w(r.marginLeft) };
|
|
291
|
+
}(t));
|
|
292
|
+
}
|
|
293
|
+
async _schedule(t) {
|
|
294
|
+
this._scheduled.has(t) || (this._scheduled.add(t), await Promise.resolve(), this._scheduled.delete(t), t.call(this));
|
|
295
|
+
}
|
|
296
|
+
async _updateDOM(t) {
|
|
297
|
+
this._scrollSize = t.scrollSize, this._adjustRange(t.range), this._childrenPos = t.childPositions, this._scrollError = t.scrollError || null;
|
|
298
|
+
const { _rangeChanged: e, _itemsChanged: i } = this;
|
|
299
|
+
this._visibilityChanged && (this._notifyVisibility(), this._visibilityChanged = !1), (e || i) && (this._notifyRange(), this._rangeChanged = !1), this._finishDOMUpdate();
|
|
300
|
+
}
|
|
301
|
+
_finishDOMUpdate() {
|
|
302
|
+
this._connected && (this._children.forEach((t) => this._childrenRO.observe(t)), this._checkScrollIntoViewTarget(this._childrenPos), this._positionChildren(this._childrenPos), this._sizeHostElement(this._scrollSize), this._correctScrollError(), this._benchmarkStart && "mark" in window.performance && window.performance.mark("uv-end"));
|
|
303
|
+
}
|
|
304
|
+
_updateLayout() {
|
|
305
|
+
this._layout && this._connected && (this._layout.items = this._items, this._updateView(), this._childMeasurements !== null && (this._measureCallback && this._measureCallback(this._childMeasurements), this._childMeasurements = null), this._layout.reflowIfNeeded(), this._benchmarkStart && "mark" in window.performance && window.performance.mark("uv-end"));
|
|
306
|
+
}
|
|
307
|
+
_handleScrollEvent() {
|
|
308
|
+
var t;
|
|
309
|
+
if (this._benchmarkStart && "mark" in window.performance) {
|
|
310
|
+
try {
|
|
311
|
+
window.performance.measure("uv-virtualizing", "uv-start", "uv-end");
|
|
312
|
+
} catch {
|
|
313
|
+
}
|
|
314
|
+
window.performance.mark("uv-start");
|
|
315
|
+
}
|
|
316
|
+
this._scrollerController.correctingScrollError === !1 && ((t = this._layout) == null || t.unpin()), this._schedule(this._updateLayout);
|
|
317
|
+
}
|
|
318
|
+
handleEvent(t) {
|
|
319
|
+
t.type === "scroll" && (t.currentTarget === window || this._clippingAncestors.includes(t.currentTarget)) && this._handleScrollEvent();
|
|
320
|
+
}
|
|
321
|
+
_handleLayoutMessage(t) {
|
|
322
|
+
t.type === "stateChanged" ? this._updateDOM(t) : t.type === "visibilityChanged" ? (this._firstVisible = t.firstVisible, this._lastVisible = t.lastVisible, this._notifyVisibility()) : t.type === "unpinned" && this._hostElement.dispatchEvent(new S());
|
|
323
|
+
}
|
|
324
|
+
get _children() {
|
|
325
|
+
const t = [];
|
|
326
|
+
let e = this._hostElement.firstElementChild;
|
|
327
|
+
for (; e; ) e.hasAttribute(b) || t.push(e), e = e.nextElementSibling;
|
|
328
|
+
return t;
|
|
329
|
+
}
|
|
330
|
+
_updateView() {
|
|
331
|
+
var l;
|
|
332
|
+
const t = this._hostElement, e = (l = this._scrollerController) == null ? void 0 : l.element, i = this._layout;
|
|
333
|
+
if (t && e && i) {
|
|
334
|
+
let r, o, a, h;
|
|
335
|
+
const n = t.getBoundingClientRect();
|
|
336
|
+
r = 0, o = 0, a = window.innerHeight, h = window.innerWidth;
|
|
337
|
+
const x = this._clippingAncestors.map((_) => _.getBoundingClientRect());
|
|
338
|
+
x.unshift(n);
|
|
339
|
+
for (const _ of x) r = Math.max(r, _.top), o = Math.max(o, _.left), a = Math.min(a, _.bottom), h = Math.min(h, _.right);
|
|
340
|
+
const T = e.getBoundingClientRect(), I = { left: n.left - T.left, top: n.top - T.top }, F = { width: e.scrollWidth, height: e.scrollHeight }, B = r - n.top + t.scrollTop, P = o - n.left + t.scrollLeft, N = Math.max(0, a - r), j = Math.max(0, h - o);
|
|
341
|
+
i.viewportSize = { width: j, height: N }, i.viewportScroll = { top: B, left: P }, i.totalScrollSize = F, i.offsetWithinScroller = I;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
_sizeHostElement(t) {
|
|
345
|
+
const i = t && t.width !== null ? Math.min(82e5, t.width) : 0, l = t && t.height !== null ? Math.min(82e5, t.height) : 0;
|
|
346
|
+
if (this._isScroller) this._getSizer().style.transform = `translate(${i}px, ${l}px)`;
|
|
347
|
+
else {
|
|
348
|
+
const r = this._hostElement.style;
|
|
349
|
+
r.minWidth = i ? `${i}px` : "100%", r.minHeight = l ? `${l}px` : "100%";
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
_positionChildren(t) {
|
|
353
|
+
t && t.forEach(({ top: e, left: i, width: l, height: r, xOffset: o, yOffset: a }, h) => {
|
|
354
|
+
const n = this._children[h - this._first];
|
|
355
|
+
n && (n.style.position = "absolute", n.style.boxSizing = "border-box", n.style.transform = `translate(${i}px, ${e}px)`, l !== void 0 && (n.style.width = l + "px"), r !== void 0 && (n.style.height = r + "px"), n.style.left = o === void 0 ? null : o + "px", n.style.top = a === void 0 ? null : a + "px");
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
async _adjustRange(t) {
|
|
359
|
+
const { _first: e, _last: i, _firstVisible: l, _lastVisible: r } = this;
|
|
360
|
+
this._first = t.first, this._last = t.last, this._firstVisible = t.firstVisible, this._lastVisible = t.lastVisible, this._rangeChanged = this._rangeChanged || this._first !== e || this._last !== i, this._visibilityChanged = this._visibilityChanged || this._firstVisible !== l || this._lastVisible !== r;
|
|
361
|
+
}
|
|
362
|
+
_correctScrollError() {
|
|
363
|
+
if (this._scrollError) {
|
|
364
|
+
const { scrollTop: t, scrollLeft: e } = this._scrollerController, { top: i, left: l } = this._scrollError;
|
|
365
|
+
this._scrollError = null, this._scrollerController.correctScrollError({ top: t - i, left: e - l });
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
element(t) {
|
|
369
|
+
var e;
|
|
370
|
+
return t === 1 / 0 && (t = this._items.length - 1), ((e = this._items) == null ? void 0 : e[t]) === void 0 ? void 0 : { scrollIntoView: (i = {}) => this._scrollElementIntoView({ ...i, index: t }) };
|
|
371
|
+
}
|
|
372
|
+
_scrollElementIntoView(t) {
|
|
373
|
+
if (t.index >= this._first && t.index <= this._last) this._children[t.index - this._first].scrollIntoView(t);
|
|
374
|
+
else if (t.index = Math.min(t.index, this._items.length - 1), t.behavior === "smooth") {
|
|
375
|
+
const e = this._layout.getScrollIntoViewCoordinates(t), { behavior: i } = t;
|
|
376
|
+
this._updateScrollIntoViewCoordinates = this._scrollerController.managedScrollTo(Object.assign(e, { behavior: i }), () => this._layout.getScrollIntoViewCoordinates(t), () => this._scrollIntoViewTarget = null), this._scrollIntoViewTarget = t;
|
|
377
|
+
} else this._layout.pin = t;
|
|
378
|
+
}
|
|
379
|
+
_checkScrollIntoViewTarget(t) {
|
|
380
|
+
const { index: e } = this._scrollIntoViewTarget || {};
|
|
381
|
+
e && (t != null && t.has(e)) && this._updateScrollIntoViewCoordinates(this._layout.getScrollIntoViewCoordinates(this._scrollIntoViewTarget));
|
|
382
|
+
}
|
|
383
|
+
_notifyRange() {
|
|
384
|
+
this._hostElement.dispatchEvent(new C({ first: this._first, last: this._last }));
|
|
385
|
+
}
|
|
386
|
+
_notifyVisibility() {
|
|
387
|
+
this._hostElement.dispatchEvent(new E({ first: this._firstVisible, last: this._lastVisible }));
|
|
388
|
+
}
|
|
389
|
+
get layoutComplete() {
|
|
390
|
+
return this._layoutCompletePromise || (this._layoutCompletePromise = new Promise((t, e) => {
|
|
391
|
+
this._layoutCompleteResolver = t, this._layoutCompleteRejecter = e;
|
|
392
|
+
})), this._layoutCompletePromise;
|
|
393
|
+
}
|
|
394
|
+
_rejectLayoutCompletePromise(t) {
|
|
395
|
+
this._layoutCompleteRejecter !== null && this._layoutCompleteRejecter(t), this._resetLayoutCompleteState();
|
|
396
|
+
}
|
|
397
|
+
_scheduleLayoutComplete() {
|
|
398
|
+
this._layoutCompletePromise && this._pendingLayoutComplete === null && (this._pendingLayoutComplete = requestAnimationFrame(() => requestAnimationFrame(() => this._resolveLayoutCompletePromise())));
|
|
399
|
+
}
|
|
400
|
+
_resolveLayoutCompletePromise() {
|
|
401
|
+
this._layoutCompleteResolver !== null && this._layoutCompleteResolver(), this._resetLayoutCompleteState();
|
|
402
|
+
}
|
|
403
|
+
_resetLayoutCompleteState() {
|
|
404
|
+
this._layoutCompletePromise = null, this._layoutCompleteResolver = null, this._layoutCompleteRejecter = null, this._pendingLayoutComplete = null;
|
|
405
|
+
}
|
|
406
|
+
_hostElementSizeChanged() {
|
|
407
|
+
this._schedule(this._updateLayout);
|
|
408
|
+
}
|
|
409
|
+
_childLoaded() {
|
|
410
|
+
}
|
|
411
|
+
_childrenSizeChanged(t) {
|
|
412
|
+
var e;
|
|
413
|
+
if ((e = this._layout) != null && e.measureChildren) {
|
|
414
|
+
for (const i of t) this._toBeMeasured.set(i.target, i.contentRect);
|
|
415
|
+
this._measureChildren();
|
|
416
|
+
}
|
|
417
|
+
this._scheduleLayoutComplete(), this._itemsChanged = !1, this._rangeChanged = !1;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
function w(s) {
|
|
421
|
+
const t = s ? parseFloat(s) : NaN;
|
|
422
|
+
return Number.isNaN(t) ? 0 : t;
|
|
423
|
+
}
|
|
424
|
+
function V(s) {
|
|
425
|
+
if (s.assignedSlot !== null) return s.assignedSlot;
|
|
426
|
+
if (s.parentElement !== null) return s.parentElement;
|
|
427
|
+
const t = s.parentNode;
|
|
428
|
+
return t && t.nodeType === Node.DOCUMENT_FRAGMENT_NODE && t.host || null;
|
|
429
|
+
}
|
|
430
|
+
const $ = (s) => s, A = (s, t) => d`${t}: ${JSON.stringify(s, null, 2)}`, Z = q(class extends G {
|
|
431
|
+
constructor(s) {
|
|
432
|
+
if (super(s), this._virtualizer = null, this._first = 0, this._last = -1, this._renderItem = (t, e) => A(t, e + this._first), this._keyFunction = (t, e) => $(t, this._first), this._items = [], s.type !== U.CHILD) throw new Error("The virtualize directive can only be used in child expressions");
|
|
433
|
+
}
|
|
434
|
+
render(s) {
|
|
435
|
+
s && this._setFunctions(s);
|
|
436
|
+
const t = [];
|
|
437
|
+
if (this._first >= 0 && this._last >= this._first) for (let e = this._first; e <= this._last; e++) t.push(this._items[e]);
|
|
438
|
+
return L(t, this._keyFunction, this._renderItem);
|
|
439
|
+
}
|
|
440
|
+
update(s, [t]) {
|
|
441
|
+
this._setFunctions(t);
|
|
442
|
+
const e = this._items !== t.items;
|
|
443
|
+
return this._items = t.items || [], this._virtualizer ? this._updateVirtualizerConfig(s, t) : this._initialize(s, t), e ? D : this.render();
|
|
444
|
+
}
|
|
445
|
+
async _updateVirtualizerConfig(s, t) {
|
|
446
|
+
if (!await this._virtualizer.updateLayoutConfig(t.layout || {})) {
|
|
447
|
+
const e = s.parentNode;
|
|
448
|
+
this._makeVirtualizer(e, t);
|
|
449
|
+
}
|
|
450
|
+
this._virtualizer.items = this._items;
|
|
451
|
+
}
|
|
452
|
+
_setFunctions(s) {
|
|
453
|
+
const { renderItem: t, keyFunction: e } = s;
|
|
454
|
+
t && (this._renderItem = (i, l) => t(i, l + this._first)), e && (this._keyFunction = (i, l) => e(i, l + this._first));
|
|
455
|
+
}
|
|
456
|
+
_makeVirtualizer(s, t) {
|
|
457
|
+
this._virtualizer && this._virtualizer.disconnected();
|
|
458
|
+
const { layout: e, scroller: i, items: l } = t;
|
|
459
|
+
this._virtualizer = new Q({ hostElement: s, layout: e, scroller: i }), this._virtualizer.items = l, this._virtualizer.connected();
|
|
460
|
+
}
|
|
461
|
+
_initialize(s, t) {
|
|
462
|
+
const e = s.parentNode;
|
|
463
|
+
e && e.nodeType === 1 && (e.addEventListener("rangeChanged", (i) => {
|
|
464
|
+
this._first = i.first, this._last = i.last, this.setValue(this.render());
|
|
465
|
+
}), this._makeVirtualizer(e, t));
|
|
466
|
+
}
|
|
467
|
+
disconnected() {
|
|
468
|
+
var s;
|
|
469
|
+
(s = this._virtualizer) == null || s.disconnected();
|
|
470
|
+
}
|
|
471
|
+
reconnected() {
|
|
472
|
+
var s;
|
|
473
|
+
(s = this._virtualizer) == null || s.connected();
|
|
474
|
+
}
|
|
475
|
+
});
|
|
476
|
+
class p extends W {
|
|
477
|
+
constructor() {
|
|
478
|
+
super(...arguments), this.items = [], this.renderItem = A, this.keyFunction = $, this.layout = {}, this.scroller = !1;
|
|
479
|
+
}
|
|
480
|
+
createRenderRoot() {
|
|
481
|
+
return this;
|
|
482
|
+
}
|
|
483
|
+
render() {
|
|
484
|
+
const { items: t, renderItem: e, keyFunction: i, layout: l, scroller: r } = this;
|
|
485
|
+
return d`${Z({ items: t, renderItem: e, keyFunction: i, layout: l, scroller: r })}`;
|
|
486
|
+
}
|
|
487
|
+
element(t) {
|
|
488
|
+
var e;
|
|
489
|
+
return (e = this[z]) == null ? void 0 : e.element(t);
|
|
490
|
+
}
|
|
491
|
+
get layoutComplete() {
|
|
492
|
+
var t;
|
|
493
|
+
return (t = this[z]) == null ? void 0 : t.layoutComplete;
|
|
494
|
+
}
|
|
495
|
+
scrollToIndex(t, e = "start") {
|
|
496
|
+
var i;
|
|
497
|
+
(i = this.element(t)) == null || i.scrollIntoView({ block: e });
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
g([f({ attribute: !1 })], p.prototype, "items", void 0), g([f()], p.prototype, "renderItem", void 0), g([f()], p.prototype, "keyFunction", void 0), g([f({ attribute: !1 })], p.prototype, "layout", void 0), g([f({ reflect: !0, type: Boolean })], p.prototype, "scroller", void 0), customElements.define("lit-virtualizer", p);
|
|
501
|
+
var tt = Object.defineProperty, et = Object.getOwnPropertyDescriptor, y = (s, t, e, i) => {
|
|
502
|
+
for (var l, r = i > 1 ? void 0 : i ? et(t, e) : t, o = s.length - 1; o >= 0; o--) (l = s[o]) && (r = (i ? l(t, e, r) : l(r)) || r);
|
|
503
|
+
return i && r && tt(t, e, r), r;
|
|
504
|
+
};
|
|
505
|
+
let u = class extends R() {
|
|
506
|
+
constructor() {
|
|
507
|
+
super(...arguments), this.columns = [], this.data = [], this.keyField = "id", this.cols = "1fr", this.actions = [];
|
|
508
|
+
}
|
|
509
|
+
handleRowEvent(s, t) {
|
|
510
|
+
this.dispatchEvent(new CustomEvent(s, { detail: t.detail, bubbles: !0, composed: !0 }));
|
|
511
|
+
}
|
|
512
|
+
render() {
|
|
513
|
+
return d`
|
|
514
|
+
<schmancy-surface fill="all" type="container" rounded="all" elevation="2">
|
|
515
|
+
<schmancy-grid class="h-full w-full" cols="1fr" rows="auto 1fr">
|
|
516
|
+
<schmancy-surface rounded="top" elevation="1" type="containerHighest" class="sticky top-0 z-10">
|
|
517
|
+
<schmancy-grid align="center" class="px-4 py-3" .cols=${this.cols} gap="md" rows="1fr">
|
|
518
|
+
${this.columns.map((s) => d`
|
|
519
|
+
<schmancy-typography align=${s.align ?? "left"} weight=${s.weight ?? "bold"}>
|
|
520
|
+
${s.name}
|
|
521
|
+
</schmancy-typography>
|
|
522
|
+
`)}
|
|
523
|
+
</schmancy-grid>
|
|
524
|
+
</schmancy-surface>
|
|
525
|
+
|
|
526
|
+
<lit-virtualizer
|
|
527
|
+
scroller
|
|
528
|
+
class="w-full h-full relative overflow-auto"
|
|
529
|
+
.items=${this.data}
|
|
530
|
+
.renderItem=${(s, t) => d`
|
|
531
|
+
<schmancy-table-row
|
|
532
|
+
.actions=${this.actions}
|
|
533
|
+
class="w-full border-b-1 border-solid border-outlineVariant"
|
|
534
|
+
.columns=${this.columns}
|
|
535
|
+
.item=${s}
|
|
536
|
+
cols=${this.cols}
|
|
537
|
+
@edit=${(e) => {
|
|
538
|
+
e.detail.item = s, e.detail.index = t, this.handleRowEvent("edit", e);
|
|
539
|
+
}}
|
|
540
|
+
@delete=${(e) => {
|
|
541
|
+
e.detail.item = s, e.detail.index = t, this.handleRowEvent("delete", e);
|
|
542
|
+
}}
|
|
543
|
+
></schmancy-table-row>
|
|
544
|
+
`}
|
|
545
|
+
></lit-virtualizer>
|
|
546
|
+
</schmancy-grid>
|
|
547
|
+
</schmancy-surface>
|
|
548
|
+
`;
|
|
549
|
+
}
|
|
550
|
+
};
|
|
551
|
+
y([c({ type: Array, attribute: !1 })], u.prototype, "columns", 2), y([c({ type: Array, attribute: !1 })], u.prototype, "data", 2), y([c({ type: String })], u.prototype, "keyField", 2), y([c({ type: String })], u.prototype, "cols", 2), y([c({ type: Array })], u.prototype, "actions", 2), u = y([M("schmancy-table-v2")], u);
|
|
552
|
+
export {
|
|
553
|
+
m as S,
|
|
554
|
+
u as a
|
|
555
|
+
};
|
|
556
|
+
//# sourceMappingURL=table-C8Lqlb9G.js.map
|