@base-framework/ui 1.2.15 → 1.2.16
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/atoms.es.js +43 -45
- package/dist/bside-template-C7AQgQ6H.js +59 -0
- package/dist/confirmation-DIaNfDm8.js +751 -0
- package/dist/full-page-B0EJ6uzY.js +4573 -0
- package/dist/index.es.js +181 -187
- package/dist/molecules.es.js +47 -47
- package/dist/organisms.es.js +62 -63
- package/dist/pages.es.js +8 -8
- package/dist/{sidebar-menu-Dz2oh95a.js → sidebar-menu-BpgoQxtT.js} +3 -3
- package/dist/{sidebar-menu-page-BImgFKeY.js → sidebar-menu-page-CUihu9QC.js} +14 -15
- package/dist/{signature-panel-h1ranAet.js → signature-panel-Cm15deyP.js} +40 -42
- package/dist/templates.es.js +6 -7
- package/dist/types/components/atoms/buttons/toggle-button.d.ts +4 -1
- package/package.json +1 -1
- package/dist/aside-template-B9V-0xle.js +0 -48
- package/dist/bside-template-oLChzjxQ.js +0 -17
- package/dist/buttons-C-_NH7ie.js +0 -254
- package/dist/empty-state-BhxU7rkJ.js +0 -2151
- package/dist/full-page-CgVI1G7F.js +0 -69
- package/dist/image-XjAp5NjV.js +0 -255
- package/dist/mobile-nav-wrapper-C7cKTxaV.js +0 -499
- package/dist/simple-search-input-DBNmoBCn.js +0 -1730
- package/dist/tooltip-F0rUYr5J.js +0 -404
|
@@ -1,1730 +0,0 @@
|
|
|
1
|
-
import { Div as r, Span as N, Button as K, OnState as J, On as T, Th as G, UseParent as et, I as st, Thead as at, Tr as nt, Table as j, P as $, Li as X, Time as ot, Ul as rt, Input as lt } from "@base-framework/atoms";
|
|
2
|
-
import { Component as R, Data as P, Atom as m, DateTime as H, DataTracker as _, Jot as it } from "@base-framework/base";
|
|
3
|
-
import { B as y, U as q } from "./buttons-C-_NH7ie.js";
|
|
4
|
-
import { Icons as S } from "./icons.es.js";
|
|
5
|
-
import { TableBody as ct, DataTableBody as dt, ScrollableTableBody as ht, List as ut } from "@base-framework/organisms";
|
|
6
|
-
import { I as ft, C as mt, c as gt } from "./image-XjAp5NjV.js";
|
|
7
|
-
const yt = (t, e) => {
|
|
8
|
-
const s = t ? t.getBoundingClientRect() : { top: 0, bottom: 0, left: 0 }, a = e.getBoundingClientRect(), n = 10, o = globalThis.scrollX, c = globalThis.scrollY;
|
|
9
|
-
let l = s.left + o, u = s.bottom + c;
|
|
10
|
-
const f = globalThis.innerHeight - s.bottom, g = s.top;
|
|
11
|
-
return l + a.width > globalThis.innerWidth && (l = globalThis.innerWidth - a.width - n), f < a.height && g > f ? u = s.top + c - a.height - n : f < a.height && (u = s.bottom + c - (a.height - f) - n), { x: l, y: u };
|
|
12
|
-
};
|
|
13
|
-
class wt extends R {
|
|
14
|
-
/**
|
|
15
|
-
* This will set up the data.
|
|
16
|
-
*
|
|
17
|
-
* @returns {object}
|
|
18
|
-
*/
|
|
19
|
-
setData() {
|
|
20
|
-
const e = this.parent.data || new P();
|
|
21
|
-
return e.set({
|
|
22
|
-
position: { x: 0, y: 0 }
|
|
23
|
-
}), e;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* This will get the class size.
|
|
27
|
-
*
|
|
28
|
-
* @returns {string}
|
|
29
|
-
*/
|
|
30
|
-
getSize() {
|
|
31
|
-
switch (this.size || "lg") {
|
|
32
|
-
// @ts-ignore
|
|
33
|
-
case "sm":
|
|
34
|
-
return "w-48";
|
|
35
|
-
// @ts-ignore
|
|
36
|
-
case "md":
|
|
37
|
-
return "w-64";
|
|
38
|
-
case "lg":
|
|
39
|
-
return "w-[250px]";
|
|
40
|
-
// @ts-ignore
|
|
41
|
-
case "xl":
|
|
42
|
-
return "w-96";
|
|
43
|
-
// @ts-ignore
|
|
44
|
-
case "2xl":
|
|
45
|
-
return "w-[400px]";
|
|
46
|
-
// @ts-ignore
|
|
47
|
-
case "fit":
|
|
48
|
-
return "w-fit";
|
|
49
|
-
// @ts-ignore
|
|
50
|
-
case "full":
|
|
51
|
-
return "w-full";
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* This will render the modal component.
|
|
56
|
-
*
|
|
57
|
-
* @returns {object}
|
|
58
|
-
*/
|
|
59
|
-
render() {
|
|
60
|
-
const e = this.getSize();
|
|
61
|
-
return r({
|
|
62
|
-
class: `absolute inset-auto fadeIn mt-2 rounded-md p-0 shadow-lg bg-popover min-h-12 backdrop:bg-transparent text-inherit r z-30 ${e}`,
|
|
63
|
-
popover: "manual",
|
|
64
|
-
toggle: (s, { state: a }) => s.newState === "closed" ? a.open = !1 : null,
|
|
65
|
-
style: "top: [[position.y]]px; left: [[position.x]]px"
|
|
66
|
-
// @ts-ignore
|
|
67
|
-
}, this.children);
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* This will setup the states.
|
|
71
|
-
*
|
|
72
|
-
* @returns {object}
|
|
73
|
-
*/
|
|
74
|
-
setupStates() {
|
|
75
|
-
return {
|
|
76
|
-
open: {
|
|
77
|
-
id: this.parent.getId(),
|
|
78
|
-
callBack: (a) => {
|
|
79
|
-
this.state.open === !1 && this.destroy();
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Updates the dropdown position.
|
|
86
|
-
*
|
|
87
|
-
* @returns {void}
|
|
88
|
-
*/
|
|
89
|
-
updatePosition() {
|
|
90
|
-
const e = this.button ?? null, s = this.panel, a = yt(e, s);
|
|
91
|
-
this.data.position = a;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* This will run after the setup.
|
|
95
|
-
*
|
|
96
|
-
* @returns {void}
|
|
97
|
-
*/
|
|
98
|
-
afterSetup() {
|
|
99
|
-
this.panel.showPopover(), this.updatePosition();
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* This will check if the element clicked was in the
|
|
103
|
-
* component of the button.
|
|
104
|
-
*
|
|
105
|
-
* @param {object} element
|
|
106
|
-
* @returns {boolean}
|
|
107
|
-
*/
|
|
108
|
-
isOutsideClick(e) {
|
|
109
|
-
return !this.panel.contains(e) && this.button && !this.button.contains(e);
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* This will set up the events.
|
|
113
|
-
*
|
|
114
|
-
* @returns {array}
|
|
115
|
-
*/
|
|
116
|
-
setupEvents() {
|
|
117
|
-
return [
|
|
118
|
-
["click", document, (e) => {
|
|
119
|
-
this.isOutsideClick(e.target) && (this.state.open = !1);
|
|
120
|
-
}],
|
|
121
|
-
["resize", globalThis, (e) => this.updatePosition()],
|
|
122
|
-
["scroll", document, (e) => this.updatePosition()]
|
|
123
|
-
];
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* This will override the set up to use the app shell.
|
|
127
|
-
*
|
|
128
|
-
* @param {object} container
|
|
129
|
-
*/
|
|
130
|
-
setContainer(e) {
|
|
131
|
-
this.container = app.root;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* This will hide the popover before destroying.
|
|
135
|
-
*
|
|
136
|
-
* @returns {void}
|
|
137
|
-
*/
|
|
138
|
-
beforeDestroy() {
|
|
139
|
-
this?.panel?.hidePopover();
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
const xt = m(({ src: t, alt: e }) => !t || t.indexOf(".") === -1 && t.indexOf("[[") === -1 ? null : ft({
|
|
143
|
-
src: t,
|
|
144
|
-
alt: e,
|
|
145
|
-
class: "rounded-full"
|
|
146
|
-
})), bt = (t) => t && (Array.isArray(t) && (t = t.join(" ")), typeof t != "string" && (t = String(t)), t.split(" ").map((e) => e.charAt(0)).join("").toUpperCase()), V = (t) => !t || t.length < 2 ? t : bt(t), Dt = (t) => N([t, (e, s) => {
|
|
147
|
-
s.textContent = V(e);
|
|
148
|
-
}]), L = {
|
|
149
|
-
xs: "h-6 w-6",
|
|
150
|
-
sm: "h-8 w-8",
|
|
151
|
-
md: "h-12 w-12",
|
|
152
|
-
lg: "h-16 w-16",
|
|
153
|
-
xl: "h-24 w-24",
|
|
154
|
-
"2xl": "h-32 w-32",
|
|
155
|
-
"3xl": "h-48 w-48",
|
|
156
|
-
"4xl": "h-64 w-64",
|
|
157
|
-
default: "h-12 w-12"
|
|
158
|
-
}, U = {
|
|
159
|
-
xs: "text-[7px]",
|
|
160
|
-
sm: "text-xs",
|
|
161
|
-
md: "text-base",
|
|
162
|
-
lg: "text-xl",
|
|
163
|
-
xl: "text-2xl",
|
|
164
|
-
"2xl": "text-3xl",
|
|
165
|
-
"3xl": "text-4xl",
|
|
166
|
-
"4xl": "text-5xl",
|
|
167
|
-
default: "text-base"
|
|
168
|
-
}, pt = (t) => L[t] || L.default, vt = (t) => U[t] || U.default, kt = (t, e = null, s = "md") => {
|
|
169
|
-
const a = V(String(t)), n = vt(s);
|
|
170
|
-
return r(
|
|
171
|
-
{
|
|
172
|
-
class: `
|
|
173
|
-
flex items-center justify-center w-full h-full rounded-full
|
|
174
|
-
bg-muted text-muted-foreground font-medium
|
|
175
|
-
${n}
|
|
176
|
-
`
|
|
177
|
-
},
|
|
178
|
-
[
|
|
179
|
-
e ? Dt(e) : N({ class: "uppercase" }, a)
|
|
180
|
-
]
|
|
181
|
-
);
|
|
182
|
-
}, St = m(({ src: t, alt: e, fallbackText: s, watcherFallback: a, size: n }) => {
|
|
183
|
-
const o = pt(n);
|
|
184
|
-
return r(
|
|
185
|
-
{
|
|
186
|
-
class: `relative flex items-center justify-center ${o}`
|
|
187
|
-
},
|
|
188
|
-
[
|
|
189
|
-
xt({ src: t, alt: e }),
|
|
190
|
-
kt(s, a, n)
|
|
191
|
-
]
|
|
192
|
-
);
|
|
193
|
-
}), Ct = ({ currentMonth: t, currentYear: e, onSelect: s }) => r(
|
|
194
|
-
{ class: "grid grid-cols-3 gap-2" },
|
|
195
|
-
H.monthNames.map(
|
|
196
|
-
(a, n) => y(
|
|
197
|
-
{
|
|
198
|
-
click: (o) => {
|
|
199
|
-
o.preventDefault(), o.stopPropagation(), s(n);
|
|
200
|
-
},
|
|
201
|
-
variant: t === n ? "primary" : "ghost",
|
|
202
|
-
"aria-label": `Select ${a} ${e}`
|
|
203
|
-
},
|
|
204
|
-
a.substring(0, 3)
|
|
205
|
-
)
|
|
206
|
-
)
|
|
207
|
-
), b = (t) => (t *= 1, t < 10 ? `0${t}` : String(t)), Mt = (t) => (t.indexOf("T") === -1 && t.indexOf(" ") === -1 && (t += "T00:00:01"), t.replace(" ", "T"), t), p = (t, e, s) => `${t}-${b(e + 1)}-${b(s)}`, It = (t) => t ? "bg-accent text-primary" : "", Ot = (t) => t ? "text-muted-foreground opacity-50" : "", Tt = (t, e) => t === e, $t = (t, e) => Tt(t, e) ? "bg-primary text-primary-foreground" : "", Rt = (t, e, s, a) => {
|
|
208
|
-
const n = $t(e, a);
|
|
209
|
-
return n || (t ? It(t) : s ? Ot(s) : "text-foreground");
|
|
210
|
-
}, Y = (t) => {
|
|
211
|
-
const {
|
|
212
|
-
day: e,
|
|
213
|
-
currentDate: s,
|
|
214
|
-
date: a,
|
|
215
|
-
isToday: n,
|
|
216
|
-
isOutsideMonth: o,
|
|
217
|
-
select: c,
|
|
218
|
-
disabled: l
|
|
219
|
-
} = t;
|
|
220
|
-
return K(
|
|
221
|
-
{
|
|
222
|
-
class: `
|
|
223
|
-
flex items-center justify-center h-9 w-auto p-0 font-normal text-sm rounded-md cursor-pointer
|
|
224
|
-
${Rt(n, s, o, a)}
|
|
225
|
-
hover:bg-muted/50 hover:text-muted-foreground focus:z-10
|
|
226
|
-
disabled:pointer-events-none disabled:opacity-50
|
|
227
|
-
`,
|
|
228
|
-
disabled: l || e === null,
|
|
229
|
-
"aria-label": e ? `Day ${e}` : null,
|
|
230
|
-
// Only call select if it's not disabled.
|
|
231
|
-
click: () => !l && c(a)
|
|
232
|
-
},
|
|
233
|
-
e.toString()
|
|
234
|
-
);
|
|
235
|
-
}, z = (t, e, s, a) => t === a.date && e === a.month && s === a.year, Pt = (t, e, s, a = !1) => {
|
|
236
|
-
const { year: n, month: o } = t, c = p(n, o, t.date), l = new Date(n, o, 1).getDay(), u = new Date(n, o + 1, 0).getDate(), f = new Date(n, o, 0).getDate(), g = [], C = o === 0 ? 11 : o - 1, v = o === 0 ? n - 1 : n;
|
|
237
|
-
for (let i = l - 1; i >= 0; i--) {
|
|
238
|
-
const h = f - i, w = z(h, C, v, e), x = new Date(v, C, h) < new Date(e.year, e.month, e.date), D = a && x;
|
|
239
|
-
g.push(
|
|
240
|
-
Y({
|
|
241
|
-
day: h,
|
|
242
|
-
currentDate: c,
|
|
243
|
-
date: p(v, C, h),
|
|
244
|
-
isToday: w,
|
|
245
|
-
isOutsideMonth: !0,
|
|
246
|
-
select: s,
|
|
247
|
-
disabled: D
|
|
248
|
-
})
|
|
249
|
-
);
|
|
250
|
-
}
|
|
251
|
-
for (let i = 1; i <= u; i++) {
|
|
252
|
-
const h = z(i, o, n, e), w = new Date(n, o, i) < new Date(e.year, e.month, e.date), x = a && w;
|
|
253
|
-
g.push(
|
|
254
|
-
Y({
|
|
255
|
-
day: i,
|
|
256
|
-
currentDate: c,
|
|
257
|
-
date: p(n, o, i),
|
|
258
|
-
isToday: h,
|
|
259
|
-
isOutsideMonth: !1,
|
|
260
|
-
select: s,
|
|
261
|
-
disabled: x
|
|
262
|
-
})
|
|
263
|
-
);
|
|
264
|
-
}
|
|
265
|
-
const k = o === 11 ? 0 : o + 1, B = o === 11 ? n + 1 : n, d = (7 - g.length % 7) % 7;
|
|
266
|
-
for (let i = 1; i <= d; i++) {
|
|
267
|
-
const h = z(i, k, B, e), w = new Date(B, k, i) < new Date(e.year, e.month, e.date), x = a && w;
|
|
268
|
-
g.push(
|
|
269
|
-
Y({
|
|
270
|
-
day: i,
|
|
271
|
-
currentDate: c,
|
|
272
|
-
date: p(B, k, i),
|
|
273
|
-
isToday: h,
|
|
274
|
-
isOutsideMonth: !0,
|
|
275
|
-
select: s,
|
|
276
|
-
disabled: x
|
|
277
|
-
})
|
|
278
|
-
);
|
|
279
|
-
}
|
|
280
|
-
return g;
|
|
281
|
-
}, E = ({ label: t, click: e }) => y(
|
|
282
|
-
{
|
|
283
|
-
class: `
|
|
284
|
-
inline-flex items-center justify-center h-7 w-7 bg-transparent p-0
|
|
285
|
-
opacity-50 hover:opacity-100 text-muted-foreground absolute
|
|
286
|
-
${t === "Previous" ? "left-1" : "right-1"}
|
|
287
|
-
focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2
|
|
288
|
-
`,
|
|
289
|
-
click: e,
|
|
290
|
-
"aria-label": `${t} month`,
|
|
291
|
-
variant: "icon",
|
|
292
|
-
icon: t === "Previous" ? S.chevron.single.left : S.chevron.single.right
|
|
293
|
-
}
|
|
294
|
-
), Bt = ({ onMonthClick: t, onYearClick: e, next: s, previous: a }) => r({ class: "flex items-center justify-center gap-x-2 relative min-h-12 text-sm font-medium" }, [
|
|
295
|
-
y({ click: t, variant: "ghost", "aria-label": "Select month" }, "[[monthName]]"),
|
|
296
|
-
y({ click: e, variant: "ghost", "aria-label": "Select year" }, "[[current.year]]"),
|
|
297
|
-
E({ label: "Previous", click: a }),
|
|
298
|
-
E({ label: "Next", click: s })
|
|
299
|
-
]), Nt = (t) => r(
|
|
300
|
-
{ class: "flex items-center justify-center h-9 w-auto text-[0.8rem] font-normal text-muted-foreground" },
|
|
301
|
-
t
|
|
302
|
-
), Ht = () => ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map(Nt), Yt = (t) => r({ class: "rdp flex flex-auto flex-col w-full gap-y-1" }, [
|
|
303
|
-
Bt({
|
|
304
|
-
onMonthClick: t.onMonthClick,
|
|
305
|
-
onYearClick: t.onYearClick,
|
|
306
|
-
next: t.next,
|
|
307
|
-
previous: t.previous
|
|
308
|
-
}),
|
|
309
|
-
r({
|
|
310
|
-
class: "flex flex-auto flex-col w-full",
|
|
311
|
-
onSet: [
|
|
312
|
-
"currentDate",
|
|
313
|
-
() => [
|
|
314
|
-
r({ class: "grid grid-cols-7" }, Ht()),
|
|
315
|
-
r(
|
|
316
|
-
{ class: "grid grid-cols-7" },
|
|
317
|
-
Pt(
|
|
318
|
-
t.current,
|
|
319
|
-
t.today,
|
|
320
|
-
t.select,
|
|
321
|
-
t.blockPriorDates
|
|
322
|
-
)
|
|
323
|
-
)
|
|
324
|
-
]
|
|
325
|
-
]
|
|
326
|
-
})
|
|
327
|
-
]), zt = ({ currentMonth: t, currentYear: e, onSelect: s }) => {
|
|
328
|
-
const a = e - 50, n = Array.from({ length: 101 }, (o, c) => a + c);
|
|
329
|
-
return r(
|
|
330
|
-
{ class: "grid grid-cols-4 gap-2 overflow-y-auto max-h-72" },
|
|
331
|
-
n.map(
|
|
332
|
-
(o) => y(
|
|
333
|
-
{
|
|
334
|
-
click: (c) => {
|
|
335
|
-
c.preventDefault(), c.stopPropagation(), s(o);
|
|
336
|
-
},
|
|
337
|
-
variant: o === e ? "primary" : "ghost",
|
|
338
|
-
"aria-label": `Select ${o}`
|
|
339
|
-
},
|
|
340
|
-
o.toString()
|
|
341
|
-
)
|
|
342
|
-
)
|
|
343
|
-
);
|
|
344
|
-
};
|
|
345
|
-
class De extends R {
|
|
346
|
-
/**
|
|
347
|
-
* This will declare the props for the compiler.
|
|
348
|
-
*
|
|
349
|
-
* @returns {void}
|
|
350
|
-
*/
|
|
351
|
-
declareProps() {
|
|
352
|
-
this.selectedDate = null, this.selectedCallBack = null, this.blockPriorDates = !1;
|
|
353
|
-
}
|
|
354
|
-
/**
|
|
355
|
-
* This will get the selected data.
|
|
356
|
-
*
|
|
357
|
-
* @param {object} today
|
|
358
|
-
* @returns {Date}
|
|
359
|
-
*/
|
|
360
|
-
getSelectedDate(e) {
|
|
361
|
-
const s = this.selectedDate ? new Date(Mt(this.selectedDate)) : e;
|
|
362
|
-
return new Date(s.getFullYear(), s.getMonth(), s.getDate());
|
|
363
|
-
}
|
|
364
|
-
/**
|
|
365
|
-
* This will set up the data for the calendar.
|
|
366
|
-
*
|
|
367
|
-
* @returns {Data}
|
|
368
|
-
*/
|
|
369
|
-
setData() {
|
|
370
|
-
const e = /* @__PURE__ */ new Date(), s = this.getSelectedDate(e), a = s.getMonth();
|
|
371
|
-
return new P({
|
|
372
|
-
monthName: this.getMonthName(a),
|
|
373
|
-
currentDate: `${s.getFullYear()}-${a + 1}-${s.getDate()}`,
|
|
374
|
-
current: {
|
|
375
|
-
date: s.getDate(),
|
|
376
|
-
year: s.getFullYear(),
|
|
377
|
-
month: a
|
|
378
|
-
},
|
|
379
|
-
today: {
|
|
380
|
-
date: e.getDate(),
|
|
381
|
-
month: e.getMonth(),
|
|
382
|
-
year: e.getFullYear()
|
|
383
|
-
}
|
|
384
|
-
});
|
|
385
|
-
}
|
|
386
|
-
/**
|
|
387
|
-
* This will set up the states for the calendar.
|
|
388
|
-
*
|
|
389
|
-
* @return {object}
|
|
390
|
-
*/
|
|
391
|
-
setupStates() {
|
|
392
|
-
return {
|
|
393
|
-
view: "calendar"
|
|
394
|
-
// 'calendar' | 'months' | 'years'
|
|
395
|
-
};
|
|
396
|
-
}
|
|
397
|
-
/**
|
|
398
|
-
* This will get the name of the month.
|
|
399
|
-
*
|
|
400
|
-
* @param {number} month
|
|
401
|
-
* @returns {string}
|
|
402
|
-
*/
|
|
403
|
-
getMonthName(e) {
|
|
404
|
-
return H.monthNames[e];
|
|
405
|
-
}
|
|
406
|
-
/**
|
|
407
|
-
* This will go to the previous month.
|
|
408
|
-
*
|
|
409
|
-
* @returns {void}
|
|
410
|
-
*/
|
|
411
|
-
goToPreviousMonth() {
|
|
412
|
-
const e = this.data;
|
|
413
|
-
let s = e.current.month, a = e.current.year;
|
|
414
|
-
s === 0 ? (s = 11, a--) : s--, this.setCurrentDate(s, a);
|
|
415
|
-
}
|
|
416
|
-
/**
|
|
417
|
-
* This will go to the next month.
|
|
418
|
-
*
|
|
419
|
-
* @returns {void}
|
|
420
|
-
*/
|
|
421
|
-
goToNextMonth() {
|
|
422
|
-
const e = this.data;
|
|
423
|
-
let s = e.current.month, a = e.current.year;
|
|
424
|
-
s === 11 ? (s = 0, a++) : s++, this.setCurrentDate(s, a);
|
|
425
|
-
}
|
|
426
|
-
/**
|
|
427
|
-
* This will set the current month and year.
|
|
428
|
-
*
|
|
429
|
-
* @param {number} month
|
|
430
|
-
* @param {number} year
|
|
431
|
-
* @param {number|null} [date=null]
|
|
432
|
-
* @returns {void}
|
|
433
|
-
*/
|
|
434
|
-
setCurrentDate(e, s, a = null) {
|
|
435
|
-
const n = this.data;
|
|
436
|
-
n.current.month = e, n.current.year = s, typeof a == "number" && (n.current.date = b(a)), n.currentDate = `${s}-${b(e + 1)}-${n.current.date}`, n.monthName = this.getMonthName(e);
|
|
437
|
-
}
|
|
438
|
-
/**
|
|
439
|
-
* This will select a date.
|
|
440
|
-
*
|
|
441
|
-
* @param {string} date
|
|
442
|
-
* @returns {void}
|
|
443
|
-
*/
|
|
444
|
-
selectDate(e) {
|
|
445
|
-
const s = /* @__PURE__ */ new Date(e + "T00:00:00");
|
|
446
|
-
this.setCurrentDate(s.getMonth(), s.getFullYear(), s.getDate()), typeof this.selectedCallBack == "function" && this.selectedCallBack(this.data.currentDate);
|
|
447
|
-
}
|
|
448
|
-
/**
|
|
449
|
-
* This will render the calendar.
|
|
450
|
-
*
|
|
451
|
-
* @returns {object}
|
|
452
|
-
*/
|
|
453
|
-
render() {
|
|
454
|
-
return r({ class: "calendar-container p-3 rounded-md border min-w-80" }, [
|
|
455
|
-
J("view", (e) => {
|
|
456
|
-
switch (e) {
|
|
457
|
-
case "months":
|
|
458
|
-
return Ct(
|
|
459
|
-
{
|
|
460
|
-
// @ts-ignore
|
|
461
|
-
currentMonth: this.data.current.month,
|
|
462
|
-
// @ts-ignore
|
|
463
|
-
currentYear: this.data.current.year,
|
|
464
|
-
onSelect: (s) => {
|
|
465
|
-
this.setCurrentDate(s, this.data.current.year), this.state.view = "calendar";
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
);
|
|
469
|
-
case "years":
|
|
470
|
-
return zt(
|
|
471
|
-
{
|
|
472
|
-
// @ts-ignore
|
|
473
|
-
currentMonth: this.data.current.month,
|
|
474
|
-
// @ts-ignore
|
|
475
|
-
currentYear: this.data.current.year,
|
|
476
|
-
onSelect: (s) => {
|
|
477
|
-
this.setCurrentDate(this.data.current.month, s), this.state.view = "calendar";
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
);
|
|
481
|
-
default:
|
|
482
|
-
return Yt({
|
|
483
|
-
// @ts-ignore
|
|
484
|
-
current: this.data.current,
|
|
485
|
-
// @ts-ignore
|
|
486
|
-
today: this.data.today,
|
|
487
|
-
select: (s) => this.selectDate(s),
|
|
488
|
-
next: () => this.goToNextMonth(),
|
|
489
|
-
previous: () => this.goToPreviousMonth(),
|
|
490
|
-
blockPriorDates: this.blockPriorDates || !1,
|
|
491
|
-
onMonthClick: (s) => {
|
|
492
|
-
s.preventDefault(), s.stopPropagation(), this.state.view = "months";
|
|
493
|
-
},
|
|
494
|
-
onYearClick: (s) => {
|
|
495
|
-
s.preventDefault(), s.stopPropagation(), this.state.view = "years";
|
|
496
|
-
}
|
|
497
|
-
});
|
|
498
|
-
}
|
|
499
|
-
})
|
|
500
|
-
]);
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
const W = ({ label: t, click: e }) => y(
|
|
504
|
-
{
|
|
505
|
-
class: `
|
|
506
|
-
inline-flex items-center justify-center h-7 w-7 bg-transparent p-0
|
|
507
|
-
opacity-50 hover:opacity-100 text-muted-foreground absolute
|
|
508
|
-
${t === "Previous" ? "left-1" : "right-1"}
|
|
509
|
-
focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2
|
|
510
|
-
`,
|
|
511
|
-
click: e,
|
|
512
|
-
"aria-label": `${t} month`,
|
|
513
|
-
variant: "icon",
|
|
514
|
-
icon: t === "Previous" ? S.chevron.single.left : S.chevron.single.right
|
|
515
|
-
}
|
|
516
|
-
), jt = ({ onMonthClick: t, onYearClick: e, next: s, previous: a }) => r({ class: "flex items-center justify-center gap-x-2 relative min-h-12 text-sm font-medium" }, [
|
|
517
|
-
y({ click: t, variant: "ghost", "aria-label": "Select month" }, "[[monthName]]"),
|
|
518
|
-
y({ click: e, variant: "ghost", "aria-label": "Select year" }, "[[current.year]]"),
|
|
519
|
-
W({ label: "Previous", click: a }),
|
|
520
|
-
W({ label: "Next", click: s })
|
|
521
|
-
]), At = (t) => r({ class: "h-9 flex items-center justify-center font-medium" }, t), Ft = () => r(
|
|
522
|
-
{ class: "grid grid-cols-7 gap-1 text-center text-xs font-medium text-muted-foreground mb-2" },
|
|
523
|
-
["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map(At)
|
|
524
|
-
), Lt = ({ day: t, iso: e, disabled: s, isStart: a, isEnd: n, isBetween: o, isOtherMonth: c, click: l }) => {
|
|
525
|
-
let u = "ghost", f = "";
|
|
526
|
-
return a || n ? (u = "default", f = "bg-primary text-primary-foreground hover:bg-primary/90") : o && (f = "bg-accent text-accent-foreground hover:bg-accent/80"), s && (f += " opacity-50 cursor-not-allowed"), c && (f += " text-muted-foreground opacity-50"), y(
|
|
527
|
-
{
|
|
528
|
-
class: `flex items-center justify-center p-0 text-sm font-medium rounded-md transition-colors ${f}`,
|
|
529
|
-
variant: u,
|
|
530
|
-
disabled: s,
|
|
531
|
-
click: (g) => {
|
|
532
|
-
g.preventDefault(), g.stopPropagation(), s || l();
|
|
533
|
-
}
|
|
534
|
-
},
|
|
535
|
-
t.toString()
|
|
536
|
-
);
|
|
537
|
-
}, Ut = ({ today: t, current: e, blockPriorDates: s, onDateClick: a }) => {
|
|
538
|
-
const { start: n, end: o } = e, c = new Date(e.year, e.month, 1).getDay(), l = new Date(e.year, e.month + 1, 0).getDate(), u = [], f = e.month === 0 ? 11 : e.month - 1, g = e.month === 0 ? e.year - 1 : e.year, C = new Date(g, f + 1, 0).getDate(), v = e.month === 11 ? 0 : e.month + 1, k = e.month === 11 ? e.year + 1 : e.year;
|
|
539
|
-
for (let d = c - 1; d >= 0; d--) {
|
|
540
|
-
const i = C - d, h = p(g, f, i), w = new Date(g, f, i), x = new Date(t.year, t.month, t.date), D = w < x, M = s && D, I = n === h, O = o === h, tt = n && o && h > n && h < o;
|
|
541
|
-
u.push({
|
|
542
|
-
day: i,
|
|
543
|
-
iso: h,
|
|
544
|
-
disabled: M,
|
|
545
|
-
isStart: I,
|
|
546
|
-
isEnd: O,
|
|
547
|
-
isBetween: tt,
|
|
548
|
-
isOtherMonth: !0,
|
|
549
|
-
click: () => a(h)
|
|
550
|
-
});
|
|
551
|
-
}
|
|
552
|
-
for (let d = 1; d <= l; d++) {
|
|
553
|
-
const i = p(e.year, e.month, d), h = new Date(e.year, e.month, d), w = new Date(t.year, t.month, t.date), x = h < w, D = s && x, M = n === i, I = o === i, O = n && o && i > n && i < o;
|
|
554
|
-
u.push({
|
|
555
|
-
day: d,
|
|
556
|
-
iso: i,
|
|
557
|
-
disabled: D,
|
|
558
|
-
isStart: M,
|
|
559
|
-
isEnd: I,
|
|
560
|
-
isBetween: O,
|
|
561
|
-
isOtherMonth: !1,
|
|
562
|
-
click: () => {
|
|
563
|
-
a(i);
|
|
564
|
-
}
|
|
565
|
-
});
|
|
566
|
-
}
|
|
567
|
-
const F = (7 - u.length % 7) % 7;
|
|
568
|
-
for (let d = 1; d <= F; d++) {
|
|
569
|
-
const i = p(k, v, d), h = new Date(k, v, d), w = new Date(t.year, t.month, t.date), x = h < w, D = s && x, M = n === i, I = o === i, O = n && o && i > n && i < o;
|
|
570
|
-
u.push({
|
|
571
|
-
day: d,
|
|
572
|
-
iso: i,
|
|
573
|
-
disabled: D,
|
|
574
|
-
isStart: M,
|
|
575
|
-
isEnd: I,
|
|
576
|
-
isBetween: O,
|
|
577
|
-
isOtherMonth: !0,
|
|
578
|
-
click: () => a(i)
|
|
579
|
-
});
|
|
580
|
-
}
|
|
581
|
-
return r(
|
|
582
|
-
{ class: "grid grid-cols-7 gap-1" },
|
|
583
|
-
u.map(
|
|
584
|
-
(d, i) => Lt({
|
|
585
|
-
day: d.day,
|
|
586
|
-
iso: d.iso,
|
|
587
|
-
disabled: d.disabled,
|
|
588
|
-
isStart: d.isStart,
|
|
589
|
-
isEnd: d.isEnd,
|
|
590
|
-
isBetween: d.isBetween,
|
|
591
|
-
isOtherMonth: d.isOtherMonth,
|
|
592
|
-
click: d.click
|
|
593
|
-
})
|
|
594
|
-
)
|
|
595
|
-
);
|
|
596
|
-
}, Et = m((t, e) => r({ class: "flex flex-auto flex-col" }, [
|
|
597
|
-
jt({
|
|
598
|
-
// @ts-ignore
|
|
599
|
-
onMonthClick: t.onMonthClick,
|
|
600
|
-
// @ts-ignore
|
|
601
|
-
onYearClick: t.onYearClick,
|
|
602
|
-
// @ts-ignore
|
|
603
|
-
next: t.next,
|
|
604
|
-
// @ts-ignore
|
|
605
|
-
previous: t.previous
|
|
606
|
-
}),
|
|
607
|
-
r({
|
|
608
|
-
class: "flex flex-auto flex-col w-full",
|
|
609
|
-
onSet: [
|
|
610
|
-
"currentDate",
|
|
611
|
-
() => [
|
|
612
|
-
Ft(),
|
|
613
|
-
Ut({
|
|
614
|
-
// @ts-ignore
|
|
615
|
-
today: t.today,
|
|
616
|
-
// @ts-ignore
|
|
617
|
-
current: t.current,
|
|
618
|
-
// @ts-ignore
|
|
619
|
-
blockPriorDates: t.blockPriorDates,
|
|
620
|
-
// @ts-ignore
|
|
621
|
-
onDateClick: t.onDateClick
|
|
622
|
-
})
|
|
623
|
-
]
|
|
624
|
-
]
|
|
625
|
-
})
|
|
626
|
-
])), Wt = ({ currentMonth: t, currentYear: e, onSelect: s }) => r(
|
|
627
|
-
{ class: "grid grid-cols-3 gap-2" },
|
|
628
|
-
H.monthNames.map(
|
|
629
|
-
(a, n) => y(
|
|
630
|
-
{
|
|
631
|
-
click: (o) => {
|
|
632
|
-
o.preventDefault(), o.stopPropagation(), s(n);
|
|
633
|
-
},
|
|
634
|
-
variant: t === n ? "primary" : "ghost",
|
|
635
|
-
"aria-label": `Select ${a} ${e}`
|
|
636
|
-
},
|
|
637
|
-
a.substring(0, 3)
|
|
638
|
-
)
|
|
639
|
-
)
|
|
640
|
-
), Qt = ({ start: t, end: e, selecting: s, onSelectStart: a, onSelectEnd: n }) => r({ class: "flex gap-x-2 mb-4" }, [
|
|
641
|
-
T("selecting", (o) => y({
|
|
642
|
-
click: a,
|
|
643
|
-
variant: o === "start" ? "primary" : "outline",
|
|
644
|
-
class: "flex-1"
|
|
645
|
-
}, [
|
|
646
|
-
r({ class: "font-medium" }, Q("current.start", "Start Date"))
|
|
647
|
-
])),
|
|
648
|
-
T("selecting", (o) => y({
|
|
649
|
-
click: n,
|
|
650
|
-
variant: o === "end" ? "primary" : "outline",
|
|
651
|
-
class: "flex-1"
|
|
652
|
-
}, [
|
|
653
|
-
r({ class: "font-medium" }, Q("current.end", "End Date"))
|
|
654
|
-
]))
|
|
655
|
-
]), Q = (t, e) => [`[[${t}]]`, (s) => s == null ? e : Kt(s)], Kt = (t) => {
|
|
656
|
-
const e = /* @__PURE__ */ new Date(t + "T00:00:00"), s = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], a = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
657
|
-
return `${s[e.getDay()]}, ${e.getDate()} ${a[e.getMonth()]}`;
|
|
658
|
-
}, Jt = ({ currentYear: t, onSelect: e }) => {
|
|
659
|
-
const s = t - 50, a = Array.from({ length: 101 }, (n, o) => s + o);
|
|
660
|
-
return r(
|
|
661
|
-
{ class: "grid grid-cols-4 gap-2 overflow-y-auto max-h-72" },
|
|
662
|
-
a.map(
|
|
663
|
-
(n) => y(
|
|
664
|
-
{
|
|
665
|
-
click: (o) => {
|
|
666
|
-
o.preventDefault(), o.stopPropagation(), e(n);
|
|
667
|
-
},
|
|
668
|
-
variant: n === t ? "primary" : "ghost",
|
|
669
|
-
"aria-label": `Select ${n}`
|
|
670
|
-
},
|
|
671
|
-
n.toString()
|
|
672
|
-
)
|
|
673
|
-
)
|
|
674
|
-
);
|
|
675
|
-
};
|
|
676
|
-
class pe extends R {
|
|
677
|
-
/**
|
|
678
|
-
* Declare compiler props.
|
|
679
|
-
*
|
|
680
|
-
* @returns {void}
|
|
681
|
-
*/
|
|
682
|
-
declareProps() {
|
|
683
|
-
this.startDate = null, this.endDate = null, this.onRangeSelect = null, this.blockPriorDates = !1;
|
|
684
|
-
}
|
|
685
|
-
/**
|
|
686
|
-
* Initialize reactive data for today and current view.
|
|
687
|
-
*
|
|
688
|
-
* @returns {Data}
|
|
689
|
-
*/
|
|
690
|
-
setData() {
|
|
691
|
-
const e = /* @__PURE__ */ new Date(), s = this.startDate ? /* @__PURE__ */ new Date(this.startDate + "T00:00:00") : e, a = s.getMonth(), n = s.getFullYear();
|
|
692
|
-
return new P({
|
|
693
|
-
today: {
|
|
694
|
-
date: e.getDate(),
|
|
695
|
-
month: e.getMonth(),
|
|
696
|
-
year: e.getFullYear()
|
|
697
|
-
},
|
|
698
|
-
monthName: this.getMonthName(a),
|
|
699
|
-
currentData: `${s.getFullYear()}-${b(s.getMonth() + 1)}-${b(s.getDate())}`,
|
|
700
|
-
current: {
|
|
701
|
-
date: e.getDate(),
|
|
702
|
-
month: a,
|
|
703
|
-
year: n,
|
|
704
|
-
start: this.startDate,
|
|
705
|
-
end: this.endDate
|
|
706
|
-
},
|
|
707
|
-
selecting: "start"
|
|
708
|
-
});
|
|
709
|
-
}
|
|
710
|
-
/**
|
|
711
|
-
* This will get the name of the month.
|
|
712
|
-
*
|
|
713
|
-
* @param {number} month
|
|
714
|
-
* @returns {string}
|
|
715
|
-
*/
|
|
716
|
-
getMonthName(e) {
|
|
717
|
-
return H.monthNames[e];
|
|
718
|
-
}
|
|
719
|
-
/**
|
|
720
|
-
* Initialize component state.
|
|
721
|
-
*
|
|
722
|
-
* @returns {{view:string}}
|
|
723
|
-
*/
|
|
724
|
-
setupStates() {
|
|
725
|
-
return {
|
|
726
|
-
view: "calendar"
|
|
727
|
-
// 'calendar', 'months', or 'years'
|
|
728
|
-
};
|
|
729
|
-
}
|
|
730
|
-
/**
|
|
731
|
-
* Handle a date cell click.
|
|
732
|
-
*
|
|
733
|
-
* @param {string} isoDate
|
|
734
|
-
* @returns {void}
|
|
735
|
-
*/
|
|
736
|
-
handleClick(e) {
|
|
737
|
-
if (this.data.selecting === "start") {
|
|
738
|
-
this.data.current.start = e, this.data.current.end = null, this.data.selecting = "end";
|
|
739
|
-
const s = /* @__PURE__ */ new Date(e + "T00:00:00");
|
|
740
|
-
this.setCurrent({
|
|
741
|
-
month: s.getMonth(),
|
|
742
|
-
year: s.getFullYear(),
|
|
743
|
-
date: s.getDate()
|
|
744
|
-
});
|
|
745
|
-
} else {
|
|
746
|
-
this.data.current.start && e < this.data.current.start ? (this.data.current.end = this.data.current.start, this.data.current.start = e) : this.data.current.end = e, this.data.selecting = "start";
|
|
747
|
-
const s = /* @__PURE__ */ new Date(e + "T00:00:00");
|
|
748
|
-
this.setCurrent({
|
|
749
|
-
month: s.getMonth(),
|
|
750
|
-
year: s.getFullYear(),
|
|
751
|
-
date: s.getDate()
|
|
752
|
-
}), typeof this.onRangeSelect == "function" && this.onRangeSelect(this.data.current.start, this.data.current.end);
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
|
-
/**
|
|
756
|
-
* Update current month/year in data.
|
|
757
|
-
*
|
|
758
|
-
* @param {object} obj
|
|
759
|
-
* @returns {void}
|
|
760
|
-
*/
|
|
761
|
-
setCurrent({ month: e, year: s, date: a = null }) {
|
|
762
|
-
const n = this.data.current;
|
|
763
|
-
n.month = (e + 12) % 12, n.year = s + (e < 0 ? -1 : e > 11 ? 1 : 0), a !== null && (n.date = a), this.data.monthName = this.getMonthName(n.month), this.data.currentDate = `${s}-${b(e + 1)}-${b(n.date)}`;
|
|
764
|
-
}
|
|
765
|
-
/**
|
|
766
|
-
* Render the range calendar.
|
|
767
|
-
*
|
|
768
|
-
* @returns {object}
|
|
769
|
-
*/
|
|
770
|
-
render() {
|
|
771
|
-
const { today: e, current: s, selecting: a } = this.data, { start: n, end: o } = s;
|
|
772
|
-
return r({ class: "range-calendar border border-border rounded-lg shadow-md p-4 w-full max-w-sm min-w-80" }, [
|
|
773
|
-
Qt({
|
|
774
|
-
start: n,
|
|
775
|
-
end: o,
|
|
776
|
-
selecting: a,
|
|
777
|
-
onSelectStart: (c) => {
|
|
778
|
-
c.preventDefault(), c.stopPropagation(), this.data.selecting = "start";
|
|
779
|
-
},
|
|
780
|
-
onSelectEnd: (c) => {
|
|
781
|
-
c.preventDefault(), c.stopPropagation(), this.data.selecting = "end";
|
|
782
|
-
}
|
|
783
|
-
}),
|
|
784
|
-
J("view", (c) => {
|
|
785
|
-
switch (c) {
|
|
786
|
-
case "months":
|
|
787
|
-
return Wt(
|
|
788
|
-
{
|
|
789
|
-
currentMonth: s.month,
|
|
790
|
-
currentYear: s.year,
|
|
791
|
-
onSelect: (l) => {
|
|
792
|
-
this.setCurrent({ month: l, year: s.year }), this.state.view = "calendar";
|
|
793
|
-
}
|
|
794
|
-
}
|
|
795
|
-
);
|
|
796
|
-
case "years":
|
|
797
|
-
return Jt(
|
|
798
|
-
{
|
|
799
|
-
currentYear: s.year,
|
|
800
|
-
onSelect: (l) => {
|
|
801
|
-
this.setCurrent({ month: s.month, year: l }), this.state.view = "calendar";
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
);
|
|
805
|
-
default:
|
|
806
|
-
return Et({
|
|
807
|
-
// @ts-ignore
|
|
808
|
-
monthName: this.data.monthName,
|
|
809
|
-
year: s.year,
|
|
810
|
-
today: e,
|
|
811
|
-
current: s,
|
|
812
|
-
blockPriorDates: this.blockPriorDates,
|
|
813
|
-
onDateClick: (l) => this.handleClick(l),
|
|
814
|
-
onMonthClick: (l) => {
|
|
815
|
-
l.preventDefault(), l.stopPropagation(), this.state.view = "months";
|
|
816
|
-
},
|
|
817
|
-
onYearClick: (l) => {
|
|
818
|
-
l.preventDefault(), l.stopPropagation(), this.state.view = "years";
|
|
819
|
-
},
|
|
820
|
-
next: () => {
|
|
821
|
-
const l = this.data.current, u = l.month === 11 ? { month: 0, year: l.year + 1 } : { month: l.month + 1, year: l.year };
|
|
822
|
-
this.setCurrent(u);
|
|
823
|
-
},
|
|
824
|
-
previous: () => {
|
|
825
|
-
const l = this.data.current, u = l.month === 0 ? { month: 11, year: l.year - 1 } : { month: l.month - 1, year: l.year };
|
|
826
|
-
this.setCurrent(u);
|
|
827
|
-
}
|
|
828
|
-
});
|
|
829
|
-
}
|
|
830
|
-
})
|
|
831
|
-
]);
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
m((t, e) => ({
|
|
835
|
-
class: "flex items-center px-4 py-2",
|
|
836
|
-
...t,
|
|
837
|
-
children: e
|
|
838
|
-
}));
|
|
839
|
-
m(({ value: t, label: e }) => K({
|
|
840
|
-
class: "inline-flex flex-auto items-center justify-center whitespace-nowrap rounded-md px-8 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",
|
|
841
|
-
onState: ["performance", { active: t }],
|
|
842
|
-
dataSet: ["performance", ["state", t, "active"]],
|
|
843
|
-
click: (s, { state: a }) => a.performance = t
|
|
844
|
-
}, e));
|
|
845
|
-
const Gt = (t, e) => {
|
|
846
|
-
const s = t.toggleAllSelectedRows();
|
|
847
|
-
e.state.checked = !s;
|
|
848
|
-
}, Xt = (t) => G({ class: `cursor-pointer py-3 px-4 text-base w-10 ${t.class || ""}` }, [
|
|
849
|
-
et((e) => new mt({ class: "mr-2", onChange: (s, a) => Gt(e, a) }))
|
|
850
|
-
]), _t = ({ align: t, sortable: e, key: s, label: a, sort: n, class: o }) => {
|
|
851
|
-
const c = t || "justify-start";
|
|
852
|
-
return G({
|
|
853
|
-
class: `cursor-pointer py-3 px-4 text-base ${o || ""}`,
|
|
854
|
-
click: e && (() => n(s))
|
|
855
|
-
}, [
|
|
856
|
-
r({ class: `flex flex-auto w-full items-center ${c}` }, [
|
|
857
|
-
N(a),
|
|
858
|
-
e && st({ class: "ml-2", html: S.arrows.upDown })
|
|
859
|
-
])
|
|
860
|
-
]);
|
|
861
|
-
}, A = (t) => at([
|
|
862
|
-
nt({
|
|
863
|
-
class: "text-muted-foreground border-b",
|
|
864
|
-
map: [
|
|
865
|
-
t.headers,
|
|
866
|
-
(e) => e.label === "checkbox" ? Xt({ toggle: t.toggle }) : _t({
|
|
867
|
-
align: e.align,
|
|
868
|
-
sortable: e.sortable,
|
|
869
|
-
key: e.key,
|
|
870
|
-
label: e.label,
|
|
871
|
-
sort: t.sort
|
|
872
|
-
})
|
|
873
|
-
]
|
|
874
|
-
})
|
|
875
|
-
]), qt = ({ key: t, rows: e, selectRow: s, rowItem: a, emptyState: n, skeleton: o, columnCount: c }) => new ct({
|
|
876
|
-
cache: "list",
|
|
877
|
-
key: t,
|
|
878
|
-
items: e,
|
|
879
|
-
rowItem: (l) => a(l, s),
|
|
880
|
-
class: "divide-y divide-border",
|
|
881
|
-
emptyState: n,
|
|
882
|
-
skeleton: o,
|
|
883
|
-
columnCount: c
|
|
884
|
-
});
|
|
885
|
-
class Z extends R {
|
|
886
|
-
/**
|
|
887
|
-
* Initializes component data.
|
|
888
|
-
*
|
|
889
|
-
* @returns {Data}
|
|
890
|
-
*/
|
|
891
|
-
setData() {
|
|
892
|
-
let e = this.rows && this.rows.length > 0;
|
|
893
|
-
return (this.loadMoreItems || this.tableData) && !e && (e = null), new P({
|
|
894
|
-
selectedRows: [],
|
|
895
|
-
// @ts-ignore
|
|
896
|
-
hasItems: e,
|
|
897
|
-
selected: !1
|
|
898
|
-
});
|
|
899
|
-
}
|
|
900
|
-
/**
|
|
901
|
-
* This will toggle all selected rows.
|
|
902
|
-
*
|
|
903
|
-
* @returns {boolean}
|
|
904
|
-
*/
|
|
905
|
-
toggleAllSelectedRows() {
|
|
906
|
-
const e = this.list.getRows(), s = this.data.selectedRows.length === e.length, a = s ? [] : e;
|
|
907
|
-
return this.data.selectedRows = a, this.updateSelected(), this.updateTable(!s), s;
|
|
908
|
-
}
|
|
909
|
-
/**
|
|
910
|
-
* This will update the selected state.
|
|
911
|
-
*
|
|
912
|
-
* @returns {void}
|
|
913
|
-
*/
|
|
914
|
-
updateSelected() {
|
|
915
|
-
const e = this.data.get("selectedRows");
|
|
916
|
-
this.data.selected = e.length > 0;
|
|
917
|
-
}
|
|
918
|
-
/**
|
|
919
|
-
* This will get the selected rows.
|
|
920
|
-
*
|
|
921
|
-
* @returns {Array<object>}
|
|
922
|
-
*/
|
|
923
|
-
getSelectedRows() {
|
|
924
|
-
return this.data.get("selectedRows");
|
|
925
|
-
}
|
|
926
|
-
/**
|
|
927
|
-
* This will update the table rows.
|
|
928
|
-
*
|
|
929
|
-
* @protected
|
|
930
|
-
* @param {boolean} selected
|
|
931
|
-
* @returns {void}
|
|
932
|
-
*/
|
|
933
|
-
updateTable(e) {
|
|
934
|
-
const s = this.list.getRows();
|
|
935
|
-
s.forEach((a) => a.selected = e), this.list.setRows(s);
|
|
936
|
-
}
|
|
937
|
-
/**
|
|
938
|
-
* Handles row selection.
|
|
939
|
-
*
|
|
940
|
-
* @param {object} row
|
|
941
|
-
*/
|
|
942
|
-
selectRow(e) {
|
|
943
|
-
const s = e.selected ?? !1;
|
|
944
|
-
e.selected = !s;
|
|
945
|
-
const a = this.data.get("selectedRows"), n = e.selected ? [...a, e] : a.filter((o) => o !== e);
|
|
946
|
-
this.data.selectedRows = n, this.updateSelected();
|
|
947
|
-
}
|
|
948
|
-
/**
|
|
949
|
-
* Gets the number of header columns.
|
|
950
|
-
*
|
|
951
|
-
* @returns {number}
|
|
952
|
-
*/
|
|
953
|
-
getHeaderColCount() {
|
|
954
|
-
return this.customHeader ? this.customHeader?.children[0]?.children?.length : this.headers ? this.headers.length : 3;
|
|
955
|
-
}
|
|
956
|
-
/**
|
|
957
|
-
* Renders the DataTable component.
|
|
958
|
-
*
|
|
959
|
-
* @returns {object}
|
|
960
|
-
*/
|
|
961
|
-
render() {
|
|
962
|
-
const e = this.border !== !1 ? "border" : "", s = this.getHeaderColCount();
|
|
963
|
-
return r({ class: "w-full flex flex-auto flex-col" }, [
|
|
964
|
-
T("hasItems", (a) => a === !1 && this.emptyState ? this.emptyState() : null),
|
|
965
|
-
r({ class: `w-full rounded-md ${e} overflow-x-auto`, onSet: ["hasItems", { hidden: !1 }] }, [
|
|
966
|
-
j({ class: "w-full" }, [
|
|
967
|
-
// @ts-ignore
|
|
968
|
-
this.headers && A({ headers: this.headers, sort: (a) => this.sortRows(a) }),
|
|
969
|
-
// @ts-ignore
|
|
970
|
-
this.customHeader ?? null,
|
|
971
|
-
qt({
|
|
972
|
-
// @ts-ignore
|
|
973
|
-
key: this.key,
|
|
974
|
-
// @ts-ignore
|
|
975
|
-
rows: this.rows,
|
|
976
|
-
// @ts-ignore
|
|
977
|
-
selectRow: this.selectRow.bind(this),
|
|
978
|
-
// @ts-ignore
|
|
979
|
-
rowItem: this.rowItem,
|
|
980
|
-
// @ts-ignore
|
|
981
|
-
emptyState: this.emptyState,
|
|
982
|
-
// @ts-ignore
|
|
983
|
-
skeleton: this.skeleton,
|
|
984
|
-
columnCount: s
|
|
985
|
-
})
|
|
986
|
-
])
|
|
987
|
-
])
|
|
988
|
-
]);
|
|
989
|
-
}
|
|
990
|
-
/**
|
|
991
|
-
* This will remove items from the list.
|
|
992
|
-
*
|
|
993
|
-
* @public
|
|
994
|
-
* @param {array} items
|
|
995
|
-
* @returns {void}
|
|
996
|
-
*/
|
|
997
|
-
remove(e) {
|
|
998
|
-
this.list.remove(e);
|
|
999
|
-
}
|
|
1000
|
-
/**
|
|
1001
|
-
* This will set the items in the list.
|
|
1002
|
-
*
|
|
1003
|
-
* @public
|
|
1004
|
-
* @param {array} rows
|
|
1005
|
-
* @returns {void}
|
|
1006
|
-
*/
|
|
1007
|
-
setRows(e) {
|
|
1008
|
-
this.list.setRows(e);
|
|
1009
|
-
}
|
|
1010
|
-
/**
|
|
1011
|
-
* This will append items to the list.
|
|
1012
|
-
*
|
|
1013
|
-
* @public
|
|
1014
|
-
* @param {array|object} items
|
|
1015
|
-
* @returns {void}
|
|
1016
|
-
*/
|
|
1017
|
-
append(e) {
|
|
1018
|
-
this.list.append(e);
|
|
1019
|
-
}
|
|
1020
|
-
/**
|
|
1021
|
-
* This will mingle the new items with the old items.
|
|
1022
|
-
*
|
|
1023
|
-
* @public
|
|
1024
|
-
* @param {Array<Object>} newItems
|
|
1025
|
-
* @param {boolean} withDelete
|
|
1026
|
-
* @returns {void}
|
|
1027
|
-
*/
|
|
1028
|
-
mingle(e, s = !1) {
|
|
1029
|
-
this.list.mingle(e, s);
|
|
1030
|
-
}
|
|
1031
|
-
/**
|
|
1032
|
-
* This will prepend items to the list.
|
|
1033
|
-
*
|
|
1034
|
-
* @public
|
|
1035
|
-
* @param {array|object} items
|
|
1036
|
-
* @returns {void}
|
|
1037
|
-
*/
|
|
1038
|
-
prepend(e) {
|
|
1039
|
-
this.list.prepend(e);
|
|
1040
|
-
}
|
|
1041
|
-
/**
|
|
1042
|
-
* This will remove the selected rows.
|
|
1043
|
-
*
|
|
1044
|
-
* @returns {void}
|
|
1045
|
-
*/
|
|
1046
|
-
beforeDestroy() {
|
|
1047
|
-
this.data.selectedRows = [];
|
|
1048
|
-
}
|
|
1049
|
-
}
|
|
1050
|
-
const Vt = (t) => new dt({
|
|
1051
|
-
cache: "list",
|
|
1052
|
-
loadMoreItems: t.loadMoreItems,
|
|
1053
|
-
offset: t.offset,
|
|
1054
|
-
limit: t.limit,
|
|
1055
|
-
key: t.key,
|
|
1056
|
-
tableData: t.tableData,
|
|
1057
|
-
items: t.items,
|
|
1058
|
-
rowItem: (e) => t.rowItem(e, t.selectRow),
|
|
1059
|
-
class: "divide-y divide-border",
|
|
1060
|
-
skeleton: t.skeleton,
|
|
1061
|
-
columnCount: t.columnCount
|
|
1062
|
-
});
|
|
1063
|
-
class Zt extends Z {
|
|
1064
|
-
/**
|
|
1065
|
-
* Renders the DataTable component.
|
|
1066
|
-
*
|
|
1067
|
-
* @returns {object}
|
|
1068
|
-
*/
|
|
1069
|
-
render() {
|
|
1070
|
-
const e = this.border !== !1 ? "border" : "", s = this.getHeaderColCount();
|
|
1071
|
-
return r({ class: "w-full flex flex-auto flex-col" }, [
|
|
1072
|
-
T("hasItems", (a) => a === !1 && this.emptyState ? this.emptyState() : null),
|
|
1073
|
-
r({ class: `w-full rounded-md ${e} overflow-x-auto`, onSet: ["hasItems", { hidden: !1 }] }, [
|
|
1074
|
-
j({ class: "w-full" }, [
|
|
1075
|
-
// @ts-ignore
|
|
1076
|
-
this.headers && A({ headers: this.headers, sort: (a) => this.sortRows(a) }),
|
|
1077
|
-
// @ts-ignore
|
|
1078
|
-
this.customHeader ?? null,
|
|
1079
|
-
Vt({
|
|
1080
|
-
// @ts-ignore
|
|
1081
|
-
loadMoreItems: this.loadMoreItems,
|
|
1082
|
-
// @ts-ignore
|
|
1083
|
-
offset: this.offset,
|
|
1084
|
-
// @ts-ignore
|
|
1085
|
-
limit: this.limit,
|
|
1086
|
-
// @ts-ignore
|
|
1087
|
-
class: this.class,
|
|
1088
|
-
// @ts-ignore
|
|
1089
|
-
tableData: this.tableData,
|
|
1090
|
-
// @ts-ignore
|
|
1091
|
-
key: this.key,
|
|
1092
|
-
// @ts-ignore
|
|
1093
|
-
items: this.rows,
|
|
1094
|
-
// @ts-ignore
|
|
1095
|
-
selectRow: this.selectRow.bind(this),
|
|
1096
|
-
// @ts-ignore
|
|
1097
|
-
rowItem: this.rowItem,
|
|
1098
|
-
// @ts-ignore
|
|
1099
|
-
skeleton: this.skeleton,
|
|
1100
|
-
columnCount: s
|
|
1101
|
-
})
|
|
1102
|
-
])
|
|
1103
|
-
])
|
|
1104
|
-
]);
|
|
1105
|
-
}
|
|
1106
|
-
/**
|
|
1107
|
-
* Refreshes the list.
|
|
1108
|
-
*
|
|
1109
|
-
* @returns {void}
|
|
1110
|
-
*/
|
|
1111
|
-
refresh() {
|
|
1112
|
-
this.list.refresh();
|
|
1113
|
-
}
|
|
1114
|
-
}
|
|
1115
|
-
const ve = m((t) => new Zt(
|
|
1116
|
-
{
|
|
1117
|
-
// @ts-ignore
|
|
1118
|
-
cache: t.cache ?? "list",
|
|
1119
|
-
// @ts-ignore
|
|
1120
|
-
tableData: t.data,
|
|
1121
|
-
// @ts-ignore
|
|
1122
|
-
loadMoreItems: t.loadMoreItems,
|
|
1123
|
-
// @ts-ignore
|
|
1124
|
-
offset: t.offset,
|
|
1125
|
-
// @ts-ignore
|
|
1126
|
-
limit: t.limit,
|
|
1127
|
-
// @ts-ignore
|
|
1128
|
-
class: t.class,
|
|
1129
|
-
// @ts-ignore
|
|
1130
|
-
key: t.key,
|
|
1131
|
-
// @ts-ignore
|
|
1132
|
-
rows: t.rows,
|
|
1133
|
-
// @ts-ignore
|
|
1134
|
-
rowItem: t.rowItem,
|
|
1135
|
-
// @ts-ignore
|
|
1136
|
-
headers: t.headers,
|
|
1137
|
-
// @ts-ignore
|
|
1138
|
-
customHeader: t.customHeader,
|
|
1139
|
-
// @ts-ignore
|
|
1140
|
-
border: t.border,
|
|
1141
|
-
// @ts-ignore
|
|
1142
|
-
emptyState: t.emptyState,
|
|
1143
|
-
// @ts-ignore
|
|
1144
|
-
skeleton: t.skeleton
|
|
1145
|
-
}
|
|
1146
|
-
)), te = (t) => new ht({
|
|
1147
|
-
cache: "list",
|
|
1148
|
-
scrollContainer: t.scrollContainer,
|
|
1149
|
-
loadMoreItems: t.loadMoreItems,
|
|
1150
|
-
offset: t.offset,
|
|
1151
|
-
limit: t.limit,
|
|
1152
|
-
key: t.key,
|
|
1153
|
-
tableData: t.tableData,
|
|
1154
|
-
items: t.items,
|
|
1155
|
-
rowItem: (e) => t.rowItem(e, t.selectRow),
|
|
1156
|
-
class: "divide-y divide-border",
|
|
1157
|
-
skeleton: t.skeleton,
|
|
1158
|
-
columnCount: t.columnCount
|
|
1159
|
-
});
|
|
1160
|
-
class ee extends Z {
|
|
1161
|
-
/**
|
|
1162
|
-
* Renders the DataTable component.
|
|
1163
|
-
*
|
|
1164
|
-
* @returns {object}
|
|
1165
|
-
*/
|
|
1166
|
-
render() {
|
|
1167
|
-
const e = this.border !== !1 ? "border" : "", s = this.getHeaderColCount();
|
|
1168
|
-
return r({ class: "w-full flex flex-auto flex-col" }, [
|
|
1169
|
-
T("hasItems", (a) => a === !1 && this.emptyState ? this.emptyState() : null),
|
|
1170
|
-
r({ class: `w-full rounded-md ${e} overflow-x-auto`, onSet: ["hasItems", { hidden: !1 }] }, [
|
|
1171
|
-
j({ class: "w-full" }, [
|
|
1172
|
-
// @ts-ignore
|
|
1173
|
-
this.headers && A({ headers: this.headers, sort: (a) => this.sortRows(a) }),
|
|
1174
|
-
// @ts-ignore
|
|
1175
|
-
this.customHeader ?? null,
|
|
1176
|
-
te({
|
|
1177
|
-
// @ts-ignore
|
|
1178
|
-
scrollContainer: this.scrollContainer,
|
|
1179
|
-
// @ts-ignore
|
|
1180
|
-
loadMoreItems: this.loadMoreItems,
|
|
1181
|
-
// @ts-ignore
|
|
1182
|
-
offset: this.offset,
|
|
1183
|
-
// @ts-ignore
|
|
1184
|
-
limit: this.limit,
|
|
1185
|
-
// @ts-ignore
|
|
1186
|
-
class: this.class,
|
|
1187
|
-
// @ts-ignore
|
|
1188
|
-
tableData: this.tableData,
|
|
1189
|
-
// @ts-ignore
|
|
1190
|
-
key: this.key,
|
|
1191
|
-
// @ts-ignore
|
|
1192
|
-
items: this.rows,
|
|
1193
|
-
// @ts-ignore
|
|
1194
|
-
selectRow: this.selectRow.bind(this),
|
|
1195
|
-
// @ts-ignore
|
|
1196
|
-
rowItem: this.rowItem,
|
|
1197
|
-
// @ts-ignore
|
|
1198
|
-
skeleton: this.skeleton,
|
|
1199
|
-
columnCount: s
|
|
1200
|
-
})
|
|
1201
|
-
])
|
|
1202
|
-
])
|
|
1203
|
-
]);
|
|
1204
|
-
}
|
|
1205
|
-
/**
|
|
1206
|
-
* Refreshes the list.
|
|
1207
|
-
*
|
|
1208
|
-
* @returns {void}
|
|
1209
|
-
*/
|
|
1210
|
-
refresh() {
|
|
1211
|
-
this.list.refresh();
|
|
1212
|
-
}
|
|
1213
|
-
}
|
|
1214
|
-
const ke = m((t) => new ee(
|
|
1215
|
-
{
|
|
1216
|
-
// @ts-ignore
|
|
1217
|
-
cache: t.cache ?? "list",
|
|
1218
|
-
// @ts-ignore
|
|
1219
|
-
tableData: t.data,
|
|
1220
|
-
// @ts-ignore
|
|
1221
|
-
scrollContainer: t.scrollContainer,
|
|
1222
|
-
// @ts-ignore
|
|
1223
|
-
loadMoreItems: t.loadMoreItems,
|
|
1224
|
-
// @ts-ignore
|
|
1225
|
-
offset: t.offset,
|
|
1226
|
-
// @ts-ignore
|
|
1227
|
-
limit: t.limit,
|
|
1228
|
-
// @ts-ignore
|
|
1229
|
-
class: t.class,
|
|
1230
|
-
// @ts-ignore
|
|
1231
|
-
key: t.key,
|
|
1232
|
-
// @ts-ignore
|
|
1233
|
-
rows: t.rows,
|
|
1234
|
-
// @ts-ignore
|
|
1235
|
-
rowItem: t.rowItem,
|
|
1236
|
-
// @ts-ignore
|
|
1237
|
-
headers: t.headers,
|
|
1238
|
-
// @ts-ignore
|
|
1239
|
-
customHeader: t.customHeader,
|
|
1240
|
-
// @ts-ignore
|
|
1241
|
-
border: t.border,
|
|
1242
|
-
// @ts-ignore
|
|
1243
|
-
emptyState: t.emptyState,
|
|
1244
|
-
// @ts-ignore
|
|
1245
|
-
skeleton: t.skeleton
|
|
1246
|
-
}
|
|
1247
|
-
)), se = m(({ name: t, email: e }) => r({ class: "min-w-0 flex-auto" }, [
|
|
1248
|
-
$({ class: "text-base font-semibold leading-6 m-0" }, t),
|
|
1249
|
-
$({ class: "truncate text-sm leading-5 text-muted-foreground m-0" }, e)
|
|
1250
|
-
])), ae = () => r({ class: "flex items-center gap-x-1.5" }, [
|
|
1251
|
-
r({ class: "flex-none rounded-full bg-emerald-500/20 p-1" }, [
|
|
1252
|
-
r({ class: "h-1.5 w-1.5 rounded-full bg-emerald-500" })
|
|
1253
|
-
]),
|
|
1254
|
-
$({ class: "text-xs leading-5 text-gray-500" }, "Online")
|
|
1255
|
-
]), ne = (t) => $({ class: "text-xs leading-5 text-muted-foreground" }, [
|
|
1256
|
-
N("Last seen "),
|
|
1257
|
-
ot({ datetime: t }, "3h ago")
|
|
1258
|
-
]), oe = (t, e) => t === "online" ? ae() : ne(e), re = m(({ role: t, lastSeen: e, status: s }) => r({ class: "hidden shrink-0 sm:flex sm:flex-col sm:items-end" }, [
|
|
1259
|
-
$({ class: "text-sm leading-6 m-0" }, t),
|
|
1260
|
-
oe(s, e)
|
|
1261
|
-
])), le = (t) => t.split(" ").map((s) => s[0]).join(""), ie = m((t) => X({ class: "fadeIn flex justify-between gap-x-6 py-4 px-4 rounded-md hover:bg-muted/50" }, [
|
|
1262
|
-
r({ class: "flex min-w-0 gap-x-4" }, [
|
|
1263
|
-
// @ts-ignore
|
|
1264
|
-
St({ src: t.image, alt: t.name, fallbackText: le(t.name) }),
|
|
1265
|
-
// @ts-ignore
|
|
1266
|
-
se({ name: t.name, email: t.email })
|
|
1267
|
-
]),
|
|
1268
|
-
re({
|
|
1269
|
-
// @ts-ignore
|
|
1270
|
-
role: t.role,
|
|
1271
|
-
// @ts-ignore
|
|
1272
|
-
lastSeen: t.lastSeen,
|
|
1273
|
-
// @ts-ignore
|
|
1274
|
-
status: t.status
|
|
1275
|
-
})
|
|
1276
|
-
])), Se = m((t) => new ut({
|
|
1277
|
-
cache: "list",
|
|
1278
|
-
key: "name",
|
|
1279
|
-
// @ts-ignore
|
|
1280
|
-
items: t.users,
|
|
1281
|
-
role: "list",
|
|
1282
|
-
class: "divide-y divide-border",
|
|
1283
|
-
rowItem: ie
|
|
1284
|
-
})), Ce = m((t) => {
|
|
1285
|
-
const e = t.margin || "m-4 ml-0";
|
|
1286
|
-
return t.allowHistory = t.allowHistory === !0, r({ class: `flex-none ${e}` }, [
|
|
1287
|
-
y({ variant: "back", class: "ghost", ...t })
|
|
1288
|
-
]);
|
|
1289
|
-
});
|
|
1290
|
-
class ce extends R {
|
|
1291
|
-
/**
|
|
1292
|
-
* This will declare the props for the compiler.
|
|
1293
|
-
*
|
|
1294
|
-
* @returns {void}
|
|
1295
|
-
*/
|
|
1296
|
-
declareProps() {
|
|
1297
|
-
this.class = "";
|
|
1298
|
-
}
|
|
1299
|
-
/**
|
|
1300
|
-
* This will render the component.
|
|
1301
|
-
*
|
|
1302
|
-
* @returns {object}
|
|
1303
|
-
*/
|
|
1304
|
-
render() {
|
|
1305
|
-
return r(
|
|
1306
|
-
{
|
|
1307
|
-
class: this.getClassName(),
|
|
1308
|
-
// @ts-ignore
|
|
1309
|
-
animateIn: this.animateIn ?? null,
|
|
1310
|
-
// @ts-ignore
|
|
1311
|
-
animateOut: this.animateOut ?? null,
|
|
1312
|
-
onSet: ["loading", {
|
|
1313
|
-
loading: !0
|
|
1314
|
-
}]
|
|
1315
|
-
},
|
|
1316
|
-
[
|
|
1317
|
-
this.addBody()
|
|
1318
|
-
]
|
|
1319
|
-
);
|
|
1320
|
-
}
|
|
1321
|
-
/**
|
|
1322
|
-
* This will get the overlay className.
|
|
1323
|
-
*
|
|
1324
|
-
* @returns {string}
|
|
1325
|
-
*/
|
|
1326
|
-
getClassName() {
|
|
1327
|
-
return `absolute flex flex-auto flex-col overlay left-0 top-0 right-0 z-20
|
|
1328
|
-
h-svh max-h-svh min-h-svh
|
|
1329
|
-
bg-background pointer-events-auto
|
|
1330
|
-
lg:left-16
|
|
1331
|
-
will-change-contents ${this.class || ""}`;
|
|
1332
|
-
}
|
|
1333
|
-
/**
|
|
1334
|
-
* This will setup and render the component.
|
|
1335
|
-
*
|
|
1336
|
-
* @param {object} container
|
|
1337
|
-
* @returns {void}
|
|
1338
|
-
*/
|
|
1339
|
-
setContainer(e) {
|
|
1340
|
-
this.container = app.root;
|
|
1341
|
-
}
|
|
1342
|
-
/**
|
|
1343
|
-
* This will setup the overlay states.
|
|
1344
|
-
*
|
|
1345
|
-
* @returns {object}
|
|
1346
|
-
*/
|
|
1347
|
-
setupStates() {
|
|
1348
|
-
return {
|
|
1349
|
-
loading: !1
|
|
1350
|
-
};
|
|
1351
|
-
}
|
|
1352
|
-
/**
|
|
1353
|
-
* This will set the loading state.= to true.
|
|
1354
|
-
*
|
|
1355
|
-
* @returns {void}
|
|
1356
|
-
*/
|
|
1357
|
-
addLoading() {
|
|
1358
|
-
this.state.loading = !0;
|
|
1359
|
-
}
|
|
1360
|
-
/**
|
|
1361
|
-
* This will set the loading state to false.
|
|
1362
|
-
*
|
|
1363
|
-
* @returns {void}
|
|
1364
|
-
*/
|
|
1365
|
-
removeLoading() {
|
|
1366
|
-
this.state.loading = !1;
|
|
1367
|
-
}
|
|
1368
|
-
/**
|
|
1369
|
-
* This will add the body of the overlay.
|
|
1370
|
-
*
|
|
1371
|
-
* @returns {object}
|
|
1372
|
-
*/
|
|
1373
|
-
addBody() {
|
|
1374
|
-
return r({ class: "body fadeIn flex flex-auto flex-col bg-background" }, this.getContents());
|
|
1375
|
-
}
|
|
1376
|
-
/**
|
|
1377
|
-
* This will get the body contents.
|
|
1378
|
-
*
|
|
1379
|
-
* @returns {array|null}
|
|
1380
|
-
*/
|
|
1381
|
-
getContents() {
|
|
1382
|
-
return this.children;
|
|
1383
|
-
}
|
|
1384
|
-
}
|
|
1385
|
-
_.addType("dockableOverlay", (t) => {
|
|
1386
|
-
if (!t)
|
|
1387
|
-
return;
|
|
1388
|
-
const e = t.component;
|
|
1389
|
-
e && e.rendered === !0 && e.state.docked === !1 && e.destroy();
|
|
1390
|
-
});
|
|
1391
|
-
class Me extends ce {
|
|
1392
|
-
/**
|
|
1393
|
-
* This will stop presistence.
|
|
1394
|
-
*
|
|
1395
|
-
* @returns {void}
|
|
1396
|
-
*/
|
|
1397
|
-
onCreated() {
|
|
1398
|
-
this.dockSize = this.maxSize || 1024;
|
|
1399
|
-
}
|
|
1400
|
-
/**
|
|
1401
|
-
* This will render the component.
|
|
1402
|
-
*
|
|
1403
|
-
* @returns {object}
|
|
1404
|
-
*/
|
|
1405
|
-
render() {
|
|
1406
|
-
const e = this.container;
|
|
1407
|
-
return r(
|
|
1408
|
-
{
|
|
1409
|
-
// @ts-ignore
|
|
1410
|
-
animateIn: this.animateIn ?? null,
|
|
1411
|
-
// @ts-ignore
|
|
1412
|
-
animateOut: this.animateOut ?? null,
|
|
1413
|
-
onState: [
|
|
1414
|
-
["loading", {
|
|
1415
|
-
loading: !0
|
|
1416
|
-
}],
|
|
1417
|
-
["docked", (s, a) => {
|
|
1418
|
-
s ? (a.className = this.getDockedClassName(), e.appendChild(a)) : (a.className = this.getClassName(), app.root.appendChild(a));
|
|
1419
|
-
}]
|
|
1420
|
-
]
|
|
1421
|
-
},
|
|
1422
|
-
[
|
|
1423
|
-
this.addBody()
|
|
1424
|
-
]
|
|
1425
|
-
);
|
|
1426
|
-
}
|
|
1427
|
-
/**
|
|
1428
|
-
* This will get the docked className.
|
|
1429
|
-
*
|
|
1430
|
-
* @returns {string}
|
|
1431
|
-
*/
|
|
1432
|
-
getDockedClassName() {
|
|
1433
|
-
return "flex flex-auto flex-col bg-background flex will-change-contents " + (this.class || "");
|
|
1434
|
-
}
|
|
1435
|
-
/**
|
|
1436
|
-
* This will setup and render the component.
|
|
1437
|
-
*
|
|
1438
|
-
* @param {object} container
|
|
1439
|
-
* @returns {void}
|
|
1440
|
-
*/
|
|
1441
|
-
setup(e) {
|
|
1442
|
-
this.container = e, this.initialize();
|
|
1443
|
-
}
|
|
1444
|
-
/**
|
|
1445
|
-
* This will setup the overlay states.
|
|
1446
|
-
*
|
|
1447
|
-
* @returns {object}
|
|
1448
|
-
*/
|
|
1449
|
-
setupStates() {
|
|
1450
|
-
return {
|
|
1451
|
-
loading: !1,
|
|
1452
|
-
docked: this.canDock()
|
|
1453
|
-
};
|
|
1454
|
-
}
|
|
1455
|
-
/**
|
|
1456
|
-
* This will check the dock size.
|
|
1457
|
-
*
|
|
1458
|
-
* @returns {void}
|
|
1459
|
-
*/
|
|
1460
|
-
afterSetup() {
|
|
1461
|
-
_.add(
|
|
1462
|
-
this.container,
|
|
1463
|
-
"dockableOverlay",
|
|
1464
|
-
{
|
|
1465
|
-
component: this
|
|
1466
|
-
}
|
|
1467
|
-
), this.onResize();
|
|
1468
|
-
}
|
|
1469
|
-
/**
|
|
1470
|
-
* This will setup the overlay events.
|
|
1471
|
-
*
|
|
1472
|
-
* @returns {Array<object>}
|
|
1473
|
-
*/
|
|
1474
|
-
setupEvents() {
|
|
1475
|
-
return [
|
|
1476
|
-
["resize", globalThis, () => this.onResize()]
|
|
1477
|
-
];
|
|
1478
|
-
}
|
|
1479
|
-
/**
|
|
1480
|
-
* This will check if the overlay can dock.
|
|
1481
|
-
*
|
|
1482
|
-
* @returns {boolean}
|
|
1483
|
-
*/
|
|
1484
|
-
canDock() {
|
|
1485
|
-
return globalThis.innerWidth >= this.dockSize;
|
|
1486
|
-
}
|
|
1487
|
-
/**
|
|
1488
|
-
* This will handle the overlay resize.
|
|
1489
|
-
*
|
|
1490
|
-
* @returns {void}
|
|
1491
|
-
*/
|
|
1492
|
-
onResize() {
|
|
1493
|
-
this.state.docked = this.canDock();
|
|
1494
|
-
}
|
|
1495
|
-
}
|
|
1496
|
-
const de = m(({ index: t, click: e, state: s }, a) => X({
|
|
1497
|
-
class: "p-2 cursor-pointer hover:bg-muted/50",
|
|
1498
|
-
onState: [
|
|
1499
|
-
[s, "selectedIndex", {
|
|
1500
|
-
"bg-accent": t,
|
|
1501
|
-
"text-white": t
|
|
1502
|
-
}]
|
|
1503
|
-
],
|
|
1504
|
-
click: () => e(t)
|
|
1505
|
-
}, a)), he = m(({ selectOption: t, state: e }) => rt({
|
|
1506
|
-
class: "border rounded-md list-none m-0 p-0 max-h-[400px] overflow-y-auto",
|
|
1507
|
-
for: ["filteredOptions", (s, a) => de({ index: a, click: t, state: e }, s.label)]
|
|
1508
|
-
})), ue = m((t) => r({ class: "relative flex flex-auto items-center" }, [
|
|
1509
|
-
gt({
|
|
1510
|
-
cache: "input",
|
|
1511
|
-
// @ts-ignore
|
|
1512
|
-
class: t.class ?? "",
|
|
1513
|
-
// @ts-ignore
|
|
1514
|
-
placeholder: t.placeholder ?? "Search...",
|
|
1515
|
-
// @ts-ignore
|
|
1516
|
-
bind: t.bind ?? [t.state, "searchQuery"],
|
|
1517
|
-
keyup: (e, s) => {
|
|
1518
|
-
s.state && (s.state.open = !1), typeof t.filterOptions == "function" && t.filterOptions(), s.dropdown && s.dropdown.updatePosition(), t.keyup && t.keyup(e, s);
|
|
1519
|
-
},
|
|
1520
|
-
pointerup: (e, s) => {
|
|
1521
|
-
typeof s.toggleDropdown == "function" && s.toggleDropdown();
|
|
1522
|
-
},
|
|
1523
|
-
keydown: (e) => [
|
|
1524
|
-
// @ts-ignore
|
|
1525
|
-
typeof t.handleKeyDown == "function" && t.handleKeyDown(e)
|
|
1526
|
-
]
|
|
1527
|
-
}),
|
|
1528
|
-
// @ts-ignore
|
|
1529
|
-
t.icon && r({ class: "absolute flex right-0 mr-2" }, [
|
|
1530
|
-
// @ts-ignore
|
|
1531
|
-
q({ size: "sm" }, t.icon)
|
|
1532
|
-
])
|
|
1533
|
-
])), fe = (t) => r({
|
|
1534
|
-
class: "relative flex fle-auto flex-col",
|
|
1535
|
-
onState: ["open", (e, s, a) => {
|
|
1536
|
-
if (e)
|
|
1537
|
-
return new wt({
|
|
1538
|
-
cache: "dropdown",
|
|
1539
|
-
parent: a,
|
|
1540
|
-
button: a.input,
|
|
1541
|
-
size: "xl"
|
|
1542
|
-
}, [
|
|
1543
|
-
he(t)
|
|
1544
|
-
]);
|
|
1545
|
-
}]
|
|
1546
|
-
}), Ie = it(
|
|
1547
|
-
{
|
|
1548
|
-
/**
|
|
1549
|
-
* This will set up the data object.
|
|
1550
|
-
*
|
|
1551
|
-
* @returns {object} - The data object.
|
|
1552
|
-
*/
|
|
1553
|
-
setData() {
|
|
1554
|
-
const t = this.options || [];
|
|
1555
|
-
return new P({
|
|
1556
|
-
options: t,
|
|
1557
|
-
filteredOptions: t
|
|
1558
|
-
});
|
|
1559
|
-
},
|
|
1560
|
-
/**
|
|
1561
|
-
* This will set up the state object.
|
|
1562
|
-
*
|
|
1563
|
-
* @returns {object} - The state object.
|
|
1564
|
-
*/
|
|
1565
|
-
state() {
|
|
1566
|
-
return {
|
|
1567
|
-
searchQuery: "",
|
|
1568
|
-
selectedIndex: -1,
|
|
1569
|
-
open: !1
|
|
1570
|
-
};
|
|
1571
|
-
},
|
|
1572
|
-
/**
|
|
1573
|
-
* This will set the selected index by query.
|
|
1574
|
-
*
|
|
1575
|
-
* @returns {void}
|
|
1576
|
-
*/
|
|
1577
|
-
setSelectedIndexByQuery() {
|
|
1578
|
-
const t = this.data.filteredOptions;
|
|
1579
|
-
let { searchQuery: e } = this.state;
|
|
1580
|
-
e = e.toLowerCase();
|
|
1581
|
-
const s = t.findIndex((a) => a.label.toLowerCase() === e);
|
|
1582
|
-
s >= 0 && (this.state.selectedIndex = s);
|
|
1583
|
-
},
|
|
1584
|
-
/**
|
|
1585
|
-
* This will filter the options.
|
|
1586
|
-
*
|
|
1587
|
-
* @returns {void}
|
|
1588
|
-
*/
|
|
1589
|
-
filterOptions() {
|
|
1590
|
-
const t = this.state.searchQuery.toLowerCase();
|
|
1591
|
-
if (t === "" || t.length === 0) {
|
|
1592
|
-
this.data.filteredOptions = this.data.options;
|
|
1593
|
-
return;
|
|
1594
|
-
}
|
|
1595
|
-
const e = this.data.get("options");
|
|
1596
|
-
this.data.filteredOptions = e.filter(
|
|
1597
|
-
(s) => s.label.toLowerCase().includes(t)
|
|
1598
|
-
);
|
|
1599
|
-
},
|
|
1600
|
-
/**
|
|
1601
|
-
* This will get the selected value.
|
|
1602
|
-
*
|
|
1603
|
-
* @returns {object}
|
|
1604
|
-
*/
|
|
1605
|
-
getValue() {
|
|
1606
|
-
const { selectedIndex: t } = this.state;
|
|
1607
|
-
return t < 0 ? null : this.data.get(`filteredOptions[${t}]`);
|
|
1608
|
-
},
|
|
1609
|
-
/**
|
|
1610
|
-
* This will select an option.
|
|
1611
|
-
*
|
|
1612
|
-
* @param {number} index - The index of the option.
|
|
1613
|
-
* @returns {void}
|
|
1614
|
-
*/
|
|
1615
|
-
selectOption(t) {
|
|
1616
|
-
this.state.selectedIndex = t;
|
|
1617
|
-
const e = this.data.get(`filteredOptions[${t}]`);
|
|
1618
|
-
this.state.searchQuery = e.label, this.state.open = !1, typeof this.onSelect == "function" && this.onSelect(e);
|
|
1619
|
-
},
|
|
1620
|
-
/**
|
|
1621
|
-
* Toggles the dropdown open state.
|
|
1622
|
-
*/
|
|
1623
|
-
toggleDropdown() {
|
|
1624
|
-
this.state.toggle("open"), this.state.open && this.setSelectedIndexByQuery();
|
|
1625
|
-
},
|
|
1626
|
-
/**
|
|
1627
|
-
* This will handle key down events.
|
|
1628
|
-
*
|
|
1629
|
-
* @param {object} event - The event object.
|
|
1630
|
-
* @returns {void}
|
|
1631
|
-
*/
|
|
1632
|
-
handleKeyDown(t) {
|
|
1633
|
-
const e = this.data.filteredOptions, { selectedIndex: s } = this.state;
|
|
1634
|
-
t.key === "ArrowDown" ? (t.preventDefault(), this.state.selectedIndex = Math.min(s + 1, e.length - 1)) : t.key === "ArrowUp" ? (t.preventDefault(), this.state.selectedIndex = Math.max(s - 1, 0)) : t.key === "Enter" && s >= 0 && (t.preventDefault(), this.selectOption(s));
|
|
1635
|
-
},
|
|
1636
|
-
/**
|
|
1637
|
-
* This will render the component.
|
|
1638
|
-
*
|
|
1639
|
-
* @returns {object} - The rendered component.
|
|
1640
|
-
*/
|
|
1641
|
-
render() {
|
|
1642
|
-
return r({ class: "relative w-full max-w-md" }, [
|
|
1643
|
-
ue({
|
|
1644
|
-
// @ts-ignore
|
|
1645
|
-
state: this.state,
|
|
1646
|
-
// @ts-ignore
|
|
1647
|
-
icon: this.icon,
|
|
1648
|
-
// @ts-ignore
|
|
1649
|
-
placeholder: this.placeholder,
|
|
1650
|
-
// @ts-ignore
|
|
1651
|
-
filterOptions: this.filterOptions.bind(this),
|
|
1652
|
-
// @ts-ignore
|
|
1653
|
-
handleKeyDown: this.handleKeyDown.bind(this)
|
|
1654
|
-
}),
|
|
1655
|
-
fe({
|
|
1656
|
-
// @ts-ignore
|
|
1657
|
-
state: this.state,
|
|
1658
|
-
// @ts-ignore
|
|
1659
|
-
setSelected: this.setSelectedIndexByQuery.bind(this),
|
|
1660
|
-
// @ts-ignore
|
|
1661
|
-
selectOption: this.selectOption.bind(this)
|
|
1662
|
-
})
|
|
1663
|
-
]);
|
|
1664
|
-
}
|
|
1665
|
-
}
|
|
1666
|
-
), Oe = m((t) => {
|
|
1667
|
-
const e = t.icon ?? S.magnifyingGlass.default;
|
|
1668
|
-
return r({
|
|
1669
|
-
// @ts-ignore
|
|
1670
|
-
class: `relative flex items-center w-full rounded-xl bg-muted/30 focus-within:ring-2 focus-within:ring-ring transition-all ${t.containerClass || ""}`
|
|
1671
|
-
}, [
|
|
1672
|
-
r({ class: "absolute left-4 flex items-center pointer-events-none text-muted-foreground" }, [
|
|
1673
|
-
q({ size: "sm" }, e)
|
|
1674
|
-
]),
|
|
1675
|
-
lt({
|
|
1676
|
-
type: "text",
|
|
1677
|
-
// @ts-ignore
|
|
1678
|
-
cache: t.cache ?? "input",
|
|
1679
|
-
// @ts-ignore
|
|
1680
|
-
class: `w-full bg-transparent border-none outline-none pl-12 pr-4 py-4 text-base text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-0 ${t.class || ""}`,
|
|
1681
|
-
// @ts-ignore
|
|
1682
|
-
placeholder: t.placeholder ?? "Search...",
|
|
1683
|
-
// @ts-ignore
|
|
1684
|
-
bind: t.bind,
|
|
1685
|
-
// @ts-ignore
|
|
1686
|
-
value: t.value,
|
|
1687
|
-
// @ts-ignore
|
|
1688
|
-
keyup: t.keyup,
|
|
1689
|
-
// @ts-ignore
|
|
1690
|
-
keydown: t.keydown,
|
|
1691
|
-
// @ts-ignore
|
|
1692
|
-
input: t.input,
|
|
1693
|
-
// @ts-ignore
|
|
1694
|
-
change: t.change,
|
|
1695
|
-
// @ts-ignore
|
|
1696
|
-
focus: t.focus,
|
|
1697
|
-
// @ts-ignore
|
|
1698
|
-
blur: t.blur
|
|
1699
|
-
})
|
|
1700
|
-
]);
|
|
1701
|
-
});
|
|
1702
|
-
export {
|
|
1703
|
-
St as A,
|
|
1704
|
-
Ce as B,
|
|
1705
|
-
De as C,
|
|
1706
|
-
Z as D,
|
|
1707
|
-
p as F,
|
|
1708
|
-
_t as H,
|
|
1709
|
-
Yt as M,
|
|
1710
|
-
ce as O,
|
|
1711
|
-
wt as P,
|
|
1712
|
-
pe as R,
|
|
1713
|
-
ke as S,
|
|
1714
|
-
A as T,
|
|
1715
|
-
Se as U,
|
|
1716
|
-
Pt as a,
|
|
1717
|
-
Xt as b,
|
|
1718
|
-
qt as c,
|
|
1719
|
-
Y as d,
|
|
1720
|
-
Nt as e,
|
|
1721
|
-
Me as f,
|
|
1722
|
-
ve as g,
|
|
1723
|
-
Ie as h,
|
|
1724
|
-
ue as i,
|
|
1725
|
-
Oe as j,
|
|
1726
|
-
ie as k,
|
|
1727
|
-
Mt as l,
|
|
1728
|
-
yt as m,
|
|
1729
|
-
b as p
|
|
1730
|
-
};
|