@base-framework/ui 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +106 -0
- package/dist/aside-template-D0KANPjh.js +35 -0
- package/dist/atoms.es.js +39 -0
- package/dist/bside-template-CDbINL4X.js +15 -0
- package/dist/calendar-DR_svCOR.js +424 -0
- package/dist/confirmation-D1Y_SgzE.js +1526 -0
- package/dist/icon-B9QUT2NY.js +47 -0
- package/dist/icons.es.js +658 -0
- package/dist/index.es.js +154 -0
- package/dist/inputs-BF3C3KfF.js +204 -0
- package/dist/mobile-nav-wrapper-7Qul1-mt.js +578 -0
- package/dist/molecules.es.js +45 -0
- package/dist/organisms.es.js +55 -0
- package/dist/pages.es.js +12 -0
- package/dist/sidebar-menu-page-M8hr9onX.js +224 -0
- package/dist/style.css +1 -0
- package/dist/tab-C_dZb2qH.js +1425 -0
- package/dist/templates.es.js +10 -0
- package/dist/tooltip-DCszmsxe.js +324 -0
- package/dist/types/components/atoms/atoms.d.ts +15 -0
- package/dist/types/components/atoms/badges/badge.d.ts +8 -0
- package/dist/types/components/atoms/buttons/buttons.d.ts +17 -0
- package/dist/types/components/atoms/cards/card.d.ts +8 -0
- package/dist/types/components/atoms/form/fieldset.d.ts +9 -0
- package/dist/types/components/atoms/form/inputs/checkbox.d.ts +10 -0
- package/dist/types/components/atoms/form/inputs/input-classes.d.ts +30 -0
- package/dist/types/components/atoms/form/inputs/inputs.d.ts +113 -0
- package/dist/types/components/atoms/form/inputs/range-slider.d.ts +10 -0
- package/dist/types/components/atoms/form/legend.d.ts +9 -0
- package/dist/types/components/atoms/form/select.d.ts +8 -0
- package/dist/types/components/atoms/icon.d.ts +8 -0
- package/dist/types/components/atoms/progress/circle-graph.d.ts +7 -0
- package/dist/types/components/atoms/progress/progress-bar.d.ts +9 -0
- package/dist/types/components/atoms/progress/semi-circle-graph.d.ts +7 -0
- package/dist/types/components/atoms/skeleton.d.ts +2 -0
- package/dist/types/components/atoms/tooltip.d.ts +12 -0
- package/dist/types/components/atoms/veil.d.ts +26 -0
- package/dist/types/components/icons/icons.d.ts +10 -0
- package/dist/types/components/molecules/alert.d.ts +7 -0
- package/dist/types/components/molecules/avatars/avatar.d.ts +15 -0
- package/dist/types/components/molecules/avatars/static-status-indicator.d.ts +2 -0
- package/dist/types/components/molecules/avatars/status-indicator.d.ts +2 -0
- package/dist/types/components/molecules/avatars/statuses.d.ts +13 -0
- package/dist/types/components/molecules/breadcrumb/breadcrumb.d.ts +11 -0
- package/dist/types/components/molecules/breadcrumb/dots-indicator.d.ts +12 -0
- package/dist/types/components/molecules/combobox/combobox.d.ts +10 -0
- package/dist/types/components/molecules/counters/atoms.d.ts +3 -0
- package/dist/types/components/molecules/counters/counter.d.ts +11 -0
- package/dist/types/components/molecules/date-time/date-picker.d.ts +11 -0
- package/dist/types/components/molecules/date-time/time-frame.d.ts +1 -0
- package/dist/types/components/molecules/date-time/time-picker.d.ts +10 -0
- package/dist/types/components/molecules/delay-component.d.ts +18 -0
- package/dist/types/components/molecules/dialogs/confirmation.d.ts +27 -0
- package/dist/types/components/molecules/dialogs/dialog-container.d.ts +8 -0
- package/dist/types/components/molecules/dialogs/dialog.d.ts +78 -0
- package/dist/types/components/molecules/dropdowns/dropdown-item.d.ts +1 -0
- package/dist/types/components/molecules/dropdowns/dropdown-menu.d.ts +61 -0
- package/dist/types/components/molecules/dropdowns/dropdown.d.ts +1 -0
- package/dist/types/components/molecules/form/form-atoms.d.ts +40 -0
- package/dist/types/components/molecules/form/form-control.d.ts +10 -0
- package/dist/types/components/molecules/form/form-field.d.ts +10 -0
- package/dist/types/components/molecules/form/form.d.ts +14 -0
- package/dist/types/components/molecules/modals/atoms.d.ts +17 -0
- package/dist/types/components/molecules/modals/modal-container.d.ts +8 -0
- package/dist/types/components/molecules/modals/modal.d.ts +124 -0
- package/dist/types/components/molecules/molecules.d.ts +31 -0
- package/dist/types/components/molecules/notifications/notification-container.d.ts +31 -0
- package/dist/types/components/molecules/notifications/notification.d.ts +79 -0
- package/dist/types/components/molecules/popover.d.ts +57 -0
- package/dist/types/components/molecules/theme-toggle.d.ts +8 -0
- package/dist/types/components/molecules/toggle/toggle.d.ts +11 -0
- package/dist/types/components/organisms/button-group.d.ts +23 -0
- package/dist/types/components/organisms/calendar/calendar.d.ts +77 -0
- package/dist/types/components/organisms/calendar/month/calendar-cells.d.ts +1 -0
- package/dist/types/components/organisms/calendar/month/day-cell.d.ts +1 -0
- package/dist/types/components/organisms/calendar/month/day-header.d.ts +1 -0
- package/dist/types/components/organisms/calendar/month/month-calendar.d.ts +1 -0
- package/dist/types/components/organisms/calendar/month/navigation-button.d.ts +1 -0
- package/dist/types/components/organisms/calendar/utils.d.ts +3 -0
- package/dist/types/components/organisms/calendar/week/utils.d.ts +6 -0
- package/dist/types/components/organisms/calendar/week/week-calendar.d.ts +90 -0
- package/dist/types/components/organisms/calendar/week/week-cell.d.ts +1 -0
- package/dist/types/components/organisms/calendar/week/week-cells.d.ts +1 -0
- package/dist/types/components/organisms/calendar/week/week-header.d.ts +1 -0
- package/dist/types/components/organisms/lists/checkbox-col.d.ts +1 -0
- package/dist/types/components/organisms/lists/data-table-body.d.ts +5 -0
- package/dist/types/components/organisms/lists/data-table.d.ts +13 -0
- package/dist/types/components/organisms/lists/header-col.d.ts +2 -0
- package/dist/types/components/organisms/lists/table-header.d.ts +5 -0
- package/dist/types/components/organisms/lists/user-list.d.ts +15 -0
- package/dist/types/components/organisms/navigation/inline-navigation.d.ts +75 -0
- package/dist/types/components/organisms/navigation/main-link.d.ts +81 -0
- package/dist/types/components/organisms/navigation/mobile/nav-wrapper/mobile-nav-wrapper.d.ts +14 -0
- package/dist/types/components/organisms/navigation/mobile/nav-wrapper/navigation-popover.d.ts +36 -0
- package/dist/types/components/organisms/navigation/mobile/nav-wrapper/popup-header.d.ts +1 -0
- package/dist/types/components/organisms/navigation/mobile/nav-wrapper/title-header.d.ts +2 -0
- package/dist/types/components/organisms/navigation/nav-button-link.d.ts +44 -0
- package/dist/types/components/organisms/navigation/navigation-atoms.d.ts +8 -0
- package/dist/types/components/organisms/navigation/navigation-menu/navigation-menu.d.ts +58 -0
- package/dist/types/components/organisms/navigation/navigation.d.ts +58 -0
- package/dist/types/components/organisms/navigation/sidebar-menu/sidebar-menu.d.ts +2 -0
- package/dist/types/components/organisms/organisms.d.ts +38 -0
- package/dist/types/components/organisms/overlays/dockable-overlay.d.ts +38 -0
- package/dist/types/components/organisms/overlays/inline-overlay.d.ts +18 -0
- package/dist/types/components/organisms/overlays/overlay.d.ts +73 -0
- package/dist/types/components/organisms/panel.d.ts +22 -0
- package/dist/types/components/organisms/search/dropdown.d.ts +8 -0
- package/dist/types/components/organisms/search/search-dropdown.d.ts +10 -0
- package/dist/types/components/organisms/search/search-input.d.ts +7 -0
- package/dist/types/components/organisms/tabs/button-tab.d.ts +65 -0
- package/dist/types/components/organisms/tabs/tab-group.d.ts +48 -0
- package/dist/types/components/organisms/tabs/tab-navigation.d.ts +62 -0
- package/dist/types/components/organisms/tabs/tab.d.ts +35 -0
- package/dist/types/components/pages/basic-page.d.ts +19 -0
- package/dist/types/components/pages/blank-page.d.ts +17 -0
- package/dist/types/components/pages/center-page.d.ts +17 -0
- package/dist/types/components/pages/full-contain-page.d.ts +17 -0
- package/dist/types/components/pages/full-page.d.ts +25 -0
- package/dist/types/components/pages/fullscreen-page.d.ts +17 -0
- package/dist/types/components/pages/main-section.d.ts +8 -0
- package/dist/types/components/pages/page.d.ts +16 -0
- package/dist/types/components/pages/pages.d.ts +10 -0
- package/dist/types/components/pages/sidebar-menu-page.d.ts +70 -0
- package/dist/types/components/pages/templates/aside-template.d.ts +8 -0
- package/dist/types/components/pages/templates/bside-template.d.ts +8 -0
- package/dist/types/components/pages/templates/full-template.d.ts +8 -0
- package/dist/types/components/pages/templates/row.d.ts +8 -0
- package/dist/types/components/pages/templates/template-atoms.d.ts +16 -0
- package/dist/types/components/pages/templates/template.d.ts +8 -0
- package/dist/types/components/pages/templates/templates.d.ts +5 -0
- package/dist/types/ui.d.ts +6 -0
- package/dist/veil-B9GQfH0d.js +29 -0
- package/package.json +57 -0
|
@@ -0,0 +1,1425 @@
|
|
|
1
|
+
var z = Object.defineProperty;
|
|
2
|
+
var Y = (e, s, t) => s in e ? z(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
|
|
3
|
+
var l = (e, s, t) => Y(e, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
+
import { Button as y, Div as o, On as U, Span as v, Th as B, UseParent as F, I as E, Thead as Q, Tr as H, Table as K, P as p, Li as D, Time as _, Nav as S, Ul as m, Section as I } from "@base-framework/atoms";
|
|
5
|
+
import { Atom as u, Component as h, Data as L, DateTime as G, Jot as M, router as k, NavLink as R } from "@base-framework/base";
|
|
6
|
+
import { B as T, I as N } from "./icon-B9QUT2NY.js";
|
|
7
|
+
import { Icons as w } from "./icons.es.js";
|
|
8
|
+
import { TableBody as V, List as q } from "@base-framework/organisms";
|
|
9
|
+
import { C as J, I as X } from "./inputs-BF3C3KfF.js";
|
|
10
|
+
import { A as Z, P as ee } from "./calendar-DR_svCOR.js";
|
|
11
|
+
u((e, s) => ({
|
|
12
|
+
class: "flex items-center px-4 py-2",
|
|
13
|
+
...e,
|
|
14
|
+
children: s
|
|
15
|
+
}));
|
|
16
|
+
u(({ value: e, label: s }) => y({
|
|
17
|
+
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",
|
|
18
|
+
onState: ["performance", { active: e }],
|
|
19
|
+
dataSet: ["performance", ["state", e, "active"]],
|
|
20
|
+
click: (t, { state: n }) => n.performance = e
|
|
21
|
+
}, s));
|
|
22
|
+
class _e extends h {
|
|
23
|
+
constructor() {
|
|
24
|
+
super(...arguments);
|
|
25
|
+
/**
|
|
26
|
+
* @member {string} class
|
|
27
|
+
*/
|
|
28
|
+
l(this, "class", null);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* This will render the component.
|
|
32
|
+
*
|
|
33
|
+
* @returns {object}
|
|
34
|
+
*/
|
|
35
|
+
render() {
|
|
36
|
+
return o({ class: this.class || "" }, this.children);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const te = (e) => {
|
|
40
|
+
const s = new Date(e, 11, 31), t = new Date(e, 0, 1);
|
|
41
|
+
return s.getDay() === 4 || // December 31 is a Thursday
|
|
42
|
+
t.getDay() === 4;
|
|
43
|
+
}, se = (e) => {
|
|
44
|
+
const s = new Date(e.valueOf()), t = (s.getDay() + 6) % 7;
|
|
45
|
+
s.setDate(s.getDate() - t + 3);
|
|
46
|
+
const n = s.getFullYear(), a = new Date(n, 0, 4);
|
|
47
|
+
a.setDate(a.getDate() - (a.getDay() + 6) % 7);
|
|
48
|
+
const i = Math.ceil((s - a) / 6048e5) + 1;
|
|
49
|
+
return i > 52 && !te(n) ? {
|
|
50
|
+
weekNumber: 1,
|
|
51
|
+
year: n + 1
|
|
52
|
+
} : {
|
|
53
|
+
weekNumber: i,
|
|
54
|
+
year: n
|
|
55
|
+
};
|
|
56
|
+
}, ne = (e, s, t) => {
|
|
57
|
+
if (t === 0) return [];
|
|
58
|
+
const n = new Date(e, s, 0).getDate();
|
|
59
|
+
return Array.from(
|
|
60
|
+
{ length: t },
|
|
61
|
+
(a, i) => new Date(e, s - 1, n - t + i + 1)
|
|
62
|
+
);
|
|
63
|
+
}, ae = (e, s, t) => Array.from({ length: t }, (n, a) => new Date(e, s + 1, a + 1)), C = (e, s) => {
|
|
64
|
+
const t = new Date(s, 0, 4), n = (t.getDay() + 6) % 7, a = new Date(t);
|
|
65
|
+
a.setDate(t.getDate() - n);
|
|
66
|
+
const i = new Date(a);
|
|
67
|
+
return i.setDate(a.getDate() + (e - 1) * 7), i;
|
|
68
|
+
}, Ge = (e, s) => {
|
|
69
|
+
const t = new Date(e, s, 1).getDay(), n = new Date(e, s + 1, 0).getDate(), a = [];
|
|
70
|
+
let i = [];
|
|
71
|
+
for (let r = 1 - t; r <= n; r++) {
|
|
72
|
+
const f = new Date(e, s, r);
|
|
73
|
+
i.push(r > 0 ? f : null), (i.length === 7 || r === n) && (a.push([...i]), i = []);
|
|
74
|
+
}
|
|
75
|
+
return a;
|
|
76
|
+
}, Ve = (e, s) => {
|
|
77
|
+
const t = new Date(e, s + 1, 0).getDate(), n = [];
|
|
78
|
+
let a = [];
|
|
79
|
+
for (let i = 1; i <= t; i++)
|
|
80
|
+
a.push(new Date(e, s, i)), a.length === 7 && (n.push(a), a = []);
|
|
81
|
+
return a.length > 0 && n.push(a), n;
|
|
82
|
+
}, ie = (e, s, t) => {
|
|
83
|
+
const n = /* @__PURE__ */ new Date();
|
|
84
|
+
return n.getDate() === e && n.getMonth() === s && n.getFullYear() === t;
|
|
85
|
+
}, oe = ({ day: e, month: s, year: t, weekNumber: n, selectWeek: a }) => {
|
|
86
|
+
const i = ie(e, s, t);
|
|
87
|
+
return y({
|
|
88
|
+
text: e || "",
|
|
89
|
+
disabled: !e,
|
|
90
|
+
class: `
|
|
91
|
+
px-2 py-1 text-center rounded-md
|
|
92
|
+
${i ? "bg-accent text-accent-foreground" : ""}
|
|
93
|
+
hover:bg-primary hover:text-primary-foreground
|
|
94
|
+
`,
|
|
95
|
+
click: () => a(n, t)
|
|
96
|
+
});
|
|
97
|
+
}, le = (e, s) => {
|
|
98
|
+
const t = new Date(e, s, 1).getDay(), n = new Date(e, s + 1, 0).getDate(), a = ne(e, s, t), i = Array.from({ length: n }, (c, b) => new Date(e, s, b + 1)), r = (a.length + i.length) % 7, f = r === 0 ? 0 : 7 - r, d = ae(e, s, f), g = [...a, ...i, ...d], x = [];
|
|
99
|
+
for (let c = 0; c < g.length; c += 7) {
|
|
100
|
+
const b = g.slice(c, c + 7), $ = b.find((P) => P) || new Date(e, s, 1), { weekNumber: A, year: j } = se($);
|
|
101
|
+
x.push({
|
|
102
|
+
weekNumber: A,
|
|
103
|
+
year: j,
|
|
104
|
+
days: b
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return x;
|
|
108
|
+
}, re = ({ selectWeek: e }) => U("month", (s, t, { data: n }) => {
|
|
109
|
+
const { year: a, month: i, currentDate: r } = n, f = le(a, i);
|
|
110
|
+
return o(
|
|
111
|
+
{ class: "grid grid-cols-8 gap-1 text-sm px-4 py-2" },
|
|
112
|
+
[
|
|
113
|
+
// Header row: "Week" label + day-of-week labels
|
|
114
|
+
o({ class: "text-xs text-center col-span-1 text-muted-foreground flex items-center" }, "Week"),
|
|
115
|
+
o(
|
|
116
|
+
{
|
|
117
|
+
class: "grid grid-cols-7 col-span-7 text-center text-muted-foreground items-center"
|
|
118
|
+
},
|
|
119
|
+
["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map(
|
|
120
|
+
(d) => v({ class: "px-1 py-1", text: d })
|
|
121
|
+
)
|
|
122
|
+
),
|
|
123
|
+
// Render each "week" row
|
|
124
|
+
...f.map(
|
|
125
|
+
({ weekNumber: d, days: g, year: x }) => o({
|
|
126
|
+
class: "grid grid-cols-8 col-span-8 items-center ring-primary rounded-sm px-1",
|
|
127
|
+
onSet: ["currentWeek", {
|
|
128
|
+
ring: d
|
|
129
|
+
}]
|
|
130
|
+
}, [
|
|
131
|
+
// Left column: ISO week number
|
|
132
|
+
o({
|
|
133
|
+
class: "font-medium text-center col-span-1 rounded-sm cursor-pointer",
|
|
134
|
+
click: () => e(d, x),
|
|
135
|
+
// If you have a 'currentWeek' state, you can highlight it with 'onSet'
|
|
136
|
+
onSet: ["currentWeek", {
|
|
137
|
+
"text-primary-foreground": d,
|
|
138
|
+
"bg-primary": d
|
|
139
|
+
}],
|
|
140
|
+
text: d ? `W${d}` : ""
|
|
141
|
+
}),
|
|
142
|
+
// The 7 cells for each day in the row
|
|
143
|
+
o(
|
|
144
|
+
{ class: "grid grid-cols-7 col-span-7 text-center" },
|
|
145
|
+
g.map(
|
|
146
|
+
(c) => oe({
|
|
147
|
+
year: (c == null ? void 0 : c.getFullYear()) || null,
|
|
148
|
+
month: (c == null ? void 0 : c.getMonth()) || null,
|
|
149
|
+
day: (c == null ? void 0 : c.getDate()) || null,
|
|
150
|
+
week: g,
|
|
151
|
+
weekNumber: d,
|
|
152
|
+
currentDate: r,
|
|
153
|
+
selectWeek: e
|
|
154
|
+
})
|
|
155
|
+
)
|
|
156
|
+
)
|
|
157
|
+
])
|
|
158
|
+
)
|
|
159
|
+
]
|
|
160
|
+
);
|
|
161
|
+
}), O = ({ label: e, click: s }) => T(
|
|
162
|
+
{
|
|
163
|
+
class: `
|
|
164
|
+
inline-flex items-center justify-center h-7 w-7 bg-transparent p-0
|
|
165
|
+
opacity-50 hover:opacity-100 text-muted-foreground absolute
|
|
166
|
+
${e === "Previous" ? "left-1" : "right-1"}
|
|
167
|
+
focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2
|
|
168
|
+
`,
|
|
169
|
+
click: s,
|
|
170
|
+
"aria-label": `${e} month`,
|
|
171
|
+
variant: "icon",
|
|
172
|
+
icon: e === "Previous" ? w.chevron.single.left : w.chevron.single.right
|
|
173
|
+
}
|
|
174
|
+
), ce = ({ next: e, previous: s }) => o({ class: "flex flex-auto min-h-12 text-sm font-medium relative justify-center items-center" }, [
|
|
175
|
+
v("[[monthName]] [[year]]"),
|
|
176
|
+
O({
|
|
177
|
+
label: "Previous",
|
|
178
|
+
click: s
|
|
179
|
+
}),
|
|
180
|
+
O({
|
|
181
|
+
label: "Next",
|
|
182
|
+
click: e
|
|
183
|
+
})
|
|
184
|
+
]);
|
|
185
|
+
class qe extends h {
|
|
186
|
+
constructor() {
|
|
187
|
+
super(...arguments);
|
|
188
|
+
/**
|
|
189
|
+
* The selected date.
|
|
190
|
+
* @member {string} selectedDate
|
|
191
|
+
* @default null
|
|
192
|
+
*/
|
|
193
|
+
l(this, "selectedDate", null);
|
|
194
|
+
/**
|
|
195
|
+
* The selected week.
|
|
196
|
+
* @member {number} selectedWeek
|
|
197
|
+
* @default null
|
|
198
|
+
*/
|
|
199
|
+
l(this, "selectedWeek", null);
|
|
200
|
+
/**
|
|
201
|
+
* The selected call back.
|
|
202
|
+
* @member {function} selectedCallBack
|
|
203
|
+
* @default null
|
|
204
|
+
*/
|
|
205
|
+
l(this, "selectedCallBack", null);
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Initializes the calendar data.
|
|
209
|
+
*
|
|
210
|
+
* @returns {Data}
|
|
211
|
+
*/
|
|
212
|
+
setData() {
|
|
213
|
+
const t = /* @__PURE__ */ new Date(), n = this.selectedWeek || this.calculateCurrentWeek(t), a = C(n, t.getFullYear());
|
|
214
|
+
return new L({
|
|
215
|
+
monthName: this.getMonthName(a.getMonth()),
|
|
216
|
+
year: a.getFullYear(),
|
|
217
|
+
month: a.getMonth(),
|
|
218
|
+
currentDate: a.getDate(),
|
|
219
|
+
currentWeek: n
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Determines the current selected date.
|
|
224
|
+
*
|
|
225
|
+
* @param {Date} today
|
|
226
|
+
* @returns {Date}
|
|
227
|
+
*/
|
|
228
|
+
getSelectedDate(t) {
|
|
229
|
+
const n = this.selectedDate ? new Date(this.selectedDate) : t;
|
|
230
|
+
return new Date(n.getFullYear(), n.getMonth(), n.getDate());
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Calculates the ISO week number for a given date.
|
|
234
|
+
*
|
|
235
|
+
* @param {Date} date
|
|
236
|
+
* @returns {number}
|
|
237
|
+
*/
|
|
238
|
+
calculateCurrentWeek(t) {
|
|
239
|
+
const n = new Date(t.valueOf()), a = (t.getDay() + 6) % 7;
|
|
240
|
+
n.setDate(n.getDate() - a + 3);
|
|
241
|
+
const i = n.valueOf();
|
|
242
|
+
return n.setMonth(0, 1), n.getDay() !== 4 && n.setMonth(0, 1 + (4 - n.getDay() + 7) % 7), 1 + Math.ceil((i - n) / 6048e5);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Gets the name of the month.
|
|
246
|
+
*
|
|
247
|
+
* @param {number} month
|
|
248
|
+
* @returns {string}
|
|
249
|
+
*/
|
|
250
|
+
getMonthName(t) {
|
|
251
|
+
return G.monthNames[t];
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Updates the calendar to show the previous month.
|
|
255
|
+
*
|
|
256
|
+
* @returns {void}
|
|
257
|
+
*/
|
|
258
|
+
goToPreviousMonth() {
|
|
259
|
+
const t = this.data;
|
|
260
|
+
let { year: n, month: a } = t;
|
|
261
|
+
a === 0 ? (a = 11, n--) : a--, this.setDate(a, n);
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Updates the calendar to show the next month.
|
|
265
|
+
*
|
|
266
|
+
* @returns {void}
|
|
267
|
+
*/
|
|
268
|
+
goToNextMonth() {
|
|
269
|
+
const t = this.data;
|
|
270
|
+
let { year: n, month: a } = t;
|
|
271
|
+
a === 11 ? (a = 0, n++) : a++, this.setDate(a, n);
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Sets the selected date.
|
|
275
|
+
*
|
|
276
|
+
* @param {number} month
|
|
277
|
+
* @param {number} year
|
|
278
|
+
* @param {number|null} [date=null]
|
|
279
|
+
* @returns {void}
|
|
280
|
+
*/
|
|
281
|
+
setDate(t, n, a) {
|
|
282
|
+
this.data.set({
|
|
283
|
+
year: n,
|
|
284
|
+
month: t,
|
|
285
|
+
monthName: this.getMonthName(t)
|
|
286
|
+
}), a && (this.data.currentDate = a);
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Handles week selection.
|
|
290
|
+
*
|
|
291
|
+
* @param {number} weekNumber
|
|
292
|
+
* @returns {void}
|
|
293
|
+
*/
|
|
294
|
+
selectWeek(t, n) {
|
|
295
|
+
this.data.currentWeek = t;
|
|
296
|
+
const a = C(t, n);
|
|
297
|
+
this.setDate(a.getMonth(), a.getFullYear(), a.getDate()), typeof this.selectedCallBack == "function" && this.selectedCallBack(t);
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Renders the WeekCalendar component.
|
|
301
|
+
*
|
|
302
|
+
* @returns {object}
|
|
303
|
+
*/
|
|
304
|
+
render() {
|
|
305
|
+
return o({ class: "week-calendar-container border rounded-md bg-background p-3" }, [
|
|
306
|
+
ce({
|
|
307
|
+
next: () => this.goToNextMonth(),
|
|
308
|
+
previous: () => this.goToPreviousMonth()
|
|
309
|
+
}),
|
|
310
|
+
re({
|
|
311
|
+
selectWeek: (t, n) => this.selectWeek(t, n)
|
|
312
|
+
})
|
|
313
|
+
]);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
const de = (e) => B({ class: `cursor-pointer py-3 px-4 text-base w-10 ${e.class || ""}` }, [
|
|
317
|
+
F((s) => new J({ class: "mr-2", onChange: () => s.toggleAllSelectedRows() }))
|
|
318
|
+
]), ue = ({ align: e, sortable: s, key: t, label: n, sort: a, class: i }) => {
|
|
319
|
+
const r = e || "justify-start";
|
|
320
|
+
return B({
|
|
321
|
+
class: `cursor-pointer py-3 px-4 text-base ${i || ""}`,
|
|
322
|
+
click: s && (() => a(t))
|
|
323
|
+
}, [
|
|
324
|
+
o({ class: `flex flex-auto w-full items-center ${r}` }, [
|
|
325
|
+
v(n),
|
|
326
|
+
s && E({ class: "ml-2", html: w.arrows.upDown })
|
|
327
|
+
])
|
|
328
|
+
]);
|
|
329
|
+
}, he = (e) => Q([
|
|
330
|
+
H({
|
|
331
|
+
class: "text-muted-foreground border-b",
|
|
332
|
+
map: [e.headers, (s) => s.label === "checkbox" ? de({ toggle: e.toggle }) : ue({
|
|
333
|
+
align: s.align,
|
|
334
|
+
sortable: s.sortable,
|
|
335
|
+
key: s.key,
|
|
336
|
+
label: s.label,
|
|
337
|
+
sort: e.sort
|
|
338
|
+
})]
|
|
339
|
+
})
|
|
340
|
+
]), fe = ({ key: e, rows: s, selectRow: t, rowItem: n }) => new V({
|
|
341
|
+
cache: "table",
|
|
342
|
+
key: e,
|
|
343
|
+
items: s,
|
|
344
|
+
rowItem: (a) => n(a, t),
|
|
345
|
+
class: "divide-y divide-border"
|
|
346
|
+
}), Je = M(
|
|
347
|
+
{
|
|
348
|
+
/**
|
|
349
|
+
* Initializes component data.
|
|
350
|
+
*
|
|
351
|
+
* @returns {Data}
|
|
352
|
+
*/
|
|
353
|
+
setData() {
|
|
354
|
+
return new L({
|
|
355
|
+
selectedRows: [],
|
|
356
|
+
selected: !1
|
|
357
|
+
});
|
|
358
|
+
},
|
|
359
|
+
/**
|
|
360
|
+
* This will toggle all selected rows.
|
|
361
|
+
*
|
|
362
|
+
* @returns {void}
|
|
363
|
+
*/
|
|
364
|
+
toggleAllSelectedRows() {
|
|
365
|
+
const e = this.table.getRows(), s = this.data.selectedRows.length === e.length, t = s ? [] : e;
|
|
366
|
+
this.data.selectedRows = t, this.updateSelected(), this.updateTable(!s);
|
|
367
|
+
},
|
|
368
|
+
/**
|
|
369
|
+
* This will update the selected state.
|
|
370
|
+
*
|
|
371
|
+
* @returns {void}
|
|
372
|
+
*/
|
|
373
|
+
updateSelected() {
|
|
374
|
+
const e = this.data.get("selectedRows");
|
|
375
|
+
this.data.selected = e.length > 0;
|
|
376
|
+
},
|
|
377
|
+
/**
|
|
378
|
+
* This will get the selected rows.
|
|
379
|
+
*
|
|
380
|
+
* @returns {Array<object>}
|
|
381
|
+
*/
|
|
382
|
+
getSelectedRows() {
|
|
383
|
+
return this.data.get("selectedRows");
|
|
384
|
+
},
|
|
385
|
+
/**
|
|
386
|
+
* This will update the table rows.
|
|
387
|
+
*
|
|
388
|
+
* @protected
|
|
389
|
+
* @param {boolean} selected
|
|
390
|
+
* @returns {void}
|
|
391
|
+
*/
|
|
392
|
+
updateTable(e) {
|
|
393
|
+
const s = this.table.getRows();
|
|
394
|
+
s.forEach((t) => t.selected = e), this.table.setRows(s);
|
|
395
|
+
},
|
|
396
|
+
/**
|
|
397
|
+
* Handles row selection.
|
|
398
|
+
*
|
|
399
|
+
* @param {object} row
|
|
400
|
+
*/
|
|
401
|
+
selectRow(e) {
|
|
402
|
+
const s = e.selected ?? !1;
|
|
403
|
+
e.selected = !s;
|
|
404
|
+
const t = this.data.get("selectedRows"), n = e.selected ? [...t, e] : t.filter((a) => a !== e);
|
|
405
|
+
this.data.selectedRows = n, this.updateSelected();
|
|
406
|
+
},
|
|
407
|
+
/**
|
|
408
|
+
* Renders the DataTable component.
|
|
409
|
+
*
|
|
410
|
+
* @returns {object}
|
|
411
|
+
*/
|
|
412
|
+
render() {
|
|
413
|
+
const e = this.rows, s = this.border !== !1 ? "border" : "";
|
|
414
|
+
return o({ class: "w-full" }, [
|
|
415
|
+
o({ class: `w-full rounded-md ${s} overflow-x-auto` }, [
|
|
416
|
+
K({ class: "w-full" }, [
|
|
417
|
+
// @ts-ignore
|
|
418
|
+
this.headers && he({ headers: this.headers, sort: (t) => this.sortRows(t) }),
|
|
419
|
+
// @ts-ignore
|
|
420
|
+
this.customHeader ?? null,
|
|
421
|
+
fe({
|
|
422
|
+
// @ts-ignore
|
|
423
|
+
key: this.key,
|
|
424
|
+
rows: e,
|
|
425
|
+
// @ts-ignore
|
|
426
|
+
selectRow: this.selectRow.bind(this),
|
|
427
|
+
// @ts-ignore
|
|
428
|
+
rowItem: this.rowItem
|
|
429
|
+
})
|
|
430
|
+
])
|
|
431
|
+
])
|
|
432
|
+
]);
|
|
433
|
+
},
|
|
434
|
+
/**
|
|
435
|
+
* This will remove items from the list.
|
|
436
|
+
*
|
|
437
|
+
* @public
|
|
438
|
+
* @param {array} items
|
|
439
|
+
* @returns {void}
|
|
440
|
+
*/
|
|
441
|
+
remove(e) {
|
|
442
|
+
this.table.remove(e);
|
|
443
|
+
},
|
|
444
|
+
/**
|
|
445
|
+
* This will set the items in the list.
|
|
446
|
+
*
|
|
447
|
+
* @public
|
|
448
|
+
* @param {array} rows
|
|
449
|
+
* @returns {void}
|
|
450
|
+
*/
|
|
451
|
+
setRows(e) {
|
|
452
|
+
this.table.setRows(e);
|
|
453
|
+
},
|
|
454
|
+
/**
|
|
455
|
+
* This will append items to the list.
|
|
456
|
+
*
|
|
457
|
+
* @public
|
|
458
|
+
* @param {array|object} items
|
|
459
|
+
* @returns {void}
|
|
460
|
+
*/
|
|
461
|
+
append(e) {
|
|
462
|
+
this.table.append(e);
|
|
463
|
+
},
|
|
464
|
+
/**
|
|
465
|
+
* This will mingle the new items with the old items.
|
|
466
|
+
*
|
|
467
|
+
* @public
|
|
468
|
+
* @param {Array<Object>} newItems
|
|
469
|
+
* @param {boolean} withDelete
|
|
470
|
+
* @returns {void}
|
|
471
|
+
*/
|
|
472
|
+
mingle(e, s = !1) {
|
|
473
|
+
this.table.mingle(e, s);
|
|
474
|
+
},
|
|
475
|
+
/**
|
|
476
|
+
* This will prepend items to the list.
|
|
477
|
+
*
|
|
478
|
+
* @public
|
|
479
|
+
* @param {array|object} items
|
|
480
|
+
* @returns {void}
|
|
481
|
+
*/
|
|
482
|
+
prepend(e) {
|
|
483
|
+
this.table.prepend(e);
|
|
484
|
+
},
|
|
485
|
+
/**
|
|
486
|
+
* This will remove the selected rows.
|
|
487
|
+
*
|
|
488
|
+
* @returns {void}
|
|
489
|
+
*/
|
|
490
|
+
beforeDestroy() {
|
|
491
|
+
this.data.selectedRows = [];
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
), ge = u(({ name: e, email: s }) => o({ class: "min-w-0 flex-auto" }, [
|
|
495
|
+
p({ class: "text-base font-semibold leading-6 m-0" }, e),
|
|
496
|
+
p({ class: "truncate text-sm leading-5 text-muted-foreground m-0" }, s)
|
|
497
|
+
])), pe = () => o({ class: "flex items-center gap-x-1.5" }, [
|
|
498
|
+
o({ class: "flex-none rounded-full bg-emerald-500/20 p-1" }, [
|
|
499
|
+
o({ class: "h-1.5 w-1.5 rounded-full bg-emerald-500" })
|
|
500
|
+
]),
|
|
501
|
+
p({ class: "text-xs leading-5 text-gray-500" }, "Online")
|
|
502
|
+
]), me = (e) => p({ class: "text-xs leading-5 text-muted-foreground" }, [
|
|
503
|
+
v("Last seen "),
|
|
504
|
+
_({ datetime: e }, "3h ago")
|
|
505
|
+
]), xe = (e, s) => e === "online" ? pe() : me(s), be = u(({ role: e, lastSeen: s, status: t }) => o({ class: "hidden shrink-0 sm:flex sm:flex-col sm:items-end" }, [
|
|
506
|
+
p({ class: "text-sm leading-6 m-0" }, e),
|
|
507
|
+
xe(t, s)
|
|
508
|
+
])), ke = (e) => e.split(" ").map((t) => t[0]).join(""), we = u((e) => D({ class: "fadeIn flex justify-between gap-x-6 py-4 px-4 rounded-md hover:bg-muted/50" }, [
|
|
509
|
+
o({ class: "flex min-w-0 gap-x-4" }, [
|
|
510
|
+
Z({ src: e.image, alt: e.name, fallbackText: ke(e.name) }),
|
|
511
|
+
ge({ name: e.name, email: e.email })
|
|
512
|
+
]),
|
|
513
|
+
be({
|
|
514
|
+
role: e.role,
|
|
515
|
+
lastSeen: e.lastSeen,
|
|
516
|
+
status: e.status
|
|
517
|
+
})
|
|
518
|
+
])), Xe = u((e) => new q({
|
|
519
|
+
cache: "list",
|
|
520
|
+
key: "name",
|
|
521
|
+
items: e.users,
|
|
522
|
+
role: "list",
|
|
523
|
+
class: "divide-y divide-border",
|
|
524
|
+
rowItem: we
|
|
525
|
+
})), ye = (e, s) => s.includes(e), ve = (e, s, t) => e.exact ? t === s : ye(s, t), De = ({ text: e, href: s, exact: t, hidden: n }) => new R({
|
|
526
|
+
text: e,
|
|
527
|
+
href: s,
|
|
528
|
+
exact: t,
|
|
529
|
+
dataSet: ["selected", ["state", !0, "active"]],
|
|
530
|
+
class: `${n ? "hidden" : "inline-flex"} items-center justify-center whitespace-nowrap px-3 py-1.5 text-sm font-medium transition-all rounded-md focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-ring focus-visible:ring-offset-background hover:bg-primary hover:text-primary-foreground disabled:opacity-50 disabled:pointer-events-none data-[state=active]:bg-primary data-[state=active]:text-primary-foreground data-[state=active]:shadow-sm`
|
|
531
|
+
});
|
|
532
|
+
class Ze extends h {
|
|
533
|
+
constructor() {
|
|
534
|
+
super(...arguments);
|
|
535
|
+
/**
|
|
536
|
+
* This will set the options.
|
|
537
|
+
* @member {array} options
|
|
538
|
+
* @default []
|
|
539
|
+
*/
|
|
540
|
+
l(this, "options", []);
|
|
541
|
+
/**
|
|
542
|
+
* This will set the class.
|
|
543
|
+
* @member {string} class
|
|
544
|
+
* @default ''
|
|
545
|
+
*/
|
|
546
|
+
l(this, "class", "");
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* This will configure the links.
|
|
550
|
+
*/
|
|
551
|
+
beforeSetup() {
|
|
552
|
+
this.links = [];
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* This will render the component.
|
|
556
|
+
*
|
|
557
|
+
* @returns {object}
|
|
558
|
+
*/
|
|
559
|
+
render() {
|
|
560
|
+
return S(
|
|
561
|
+
{ class: `flex items-center justify-center p-2 text-muted-foreground rounded-md ${this.class || ""}` },
|
|
562
|
+
[
|
|
563
|
+
m({
|
|
564
|
+
class: "flex space-x-4",
|
|
565
|
+
map: [this.options, (t) => this.addLink(t)],
|
|
566
|
+
watch: {
|
|
567
|
+
value: ["[[path]]", k.data],
|
|
568
|
+
callBack: this.updateLinks.bind(this)
|
|
569
|
+
}
|
|
570
|
+
})
|
|
571
|
+
]
|
|
572
|
+
);
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* This will update the links.
|
|
576
|
+
*
|
|
577
|
+
* @returns {void}
|
|
578
|
+
*/
|
|
579
|
+
afterSetup() {
|
|
580
|
+
const t = k.data.path;
|
|
581
|
+
this.updateLinks(t);
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* This will update the links based on the current path.
|
|
585
|
+
*
|
|
586
|
+
* @param {string} path
|
|
587
|
+
* @returns {void}
|
|
588
|
+
*/
|
|
589
|
+
updateLinks(t) {
|
|
590
|
+
let n = !1;
|
|
591
|
+
this.deactivateAllLinks();
|
|
592
|
+
for (const a of this.links) {
|
|
593
|
+
if (!a.rendered)
|
|
594
|
+
continue;
|
|
595
|
+
ve(a, a.getLinkPath(), t) ? (this.updateLink(a, !0), n = !0) : this.updateLink(a, !1);
|
|
596
|
+
}
|
|
597
|
+
!n && this.links[0] && this.updateLink(this.links[0], !0);
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* This will deactivate all links.
|
|
601
|
+
*
|
|
602
|
+
* @returns {void}
|
|
603
|
+
*/
|
|
604
|
+
deactivateAllLinks() {
|
|
605
|
+
for (const t of this.links)
|
|
606
|
+
this.updateLink(t, !1);
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* This will update the link's active state.
|
|
610
|
+
*
|
|
611
|
+
* @param {object} link
|
|
612
|
+
* @param {boolean} selected
|
|
613
|
+
* @returns {void}
|
|
614
|
+
*/
|
|
615
|
+
updateLink(t, n) {
|
|
616
|
+
t.update(n);
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* This will add a link to the navigation.
|
|
620
|
+
*
|
|
621
|
+
* @param {object} option
|
|
622
|
+
* @returns {object}
|
|
623
|
+
*/
|
|
624
|
+
addLink({ label: t, href: n, exact: a, hidden: i }) {
|
|
625
|
+
const r = De({ text: t, href: n, exact: a, hidden: i });
|
|
626
|
+
return this.links.push(r), r;
|
|
627
|
+
}
|
|
628
|
+
/**
|
|
629
|
+
* This will clear the links.
|
|
630
|
+
*
|
|
631
|
+
* @returns {void}
|
|
632
|
+
*/
|
|
633
|
+
beforeDestroy() {
|
|
634
|
+
this.links = [];
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
const et = u((e) => {
|
|
638
|
+
const s = e.margin || "m-4 ml-0";
|
|
639
|
+
return o({ class: `flex-none ${s}` }, [
|
|
640
|
+
T({
|
|
641
|
+
variant: "icon",
|
|
642
|
+
class: "back-button",
|
|
643
|
+
click: () => {
|
|
644
|
+
if (window.history.length > 2) {
|
|
645
|
+
window.history.back();
|
|
646
|
+
return;
|
|
647
|
+
}
|
|
648
|
+
e.backUrl && app.navigate(e.backUrl);
|
|
649
|
+
}
|
|
650
|
+
}, [
|
|
651
|
+
N(w.arrows.left)
|
|
652
|
+
])
|
|
653
|
+
]);
|
|
654
|
+
});
|
|
655
|
+
class W extends h {
|
|
656
|
+
constructor() {
|
|
657
|
+
super(...arguments);
|
|
658
|
+
/**
|
|
659
|
+
* @member {string} class
|
|
660
|
+
* @default ''
|
|
661
|
+
*/
|
|
662
|
+
l(this, "class", "");
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* This will render the component.
|
|
666
|
+
*
|
|
667
|
+
* @returns {object}
|
|
668
|
+
*/
|
|
669
|
+
render() {
|
|
670
|
+
return o(
|
|
671
|
+
{
|
|
672
|
+
class: this.getClassName(),
|
|
673
|
+
onSet: ["loading", {
|
|
674
|
+
loading: !0
|
|
675
|
+
}]
|
|
676
|
+
},
|
|
677
|
+
[
|
|
678
|
+
this.addBody()
|
|
679
|
+
]
|
|
680
|
+
);
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* This will get the overlay className.
|
|
684
|
+
*
|
|
685
|
+
* @returns {string}
|
|
686
|
+
*/
|
|
687
|
+
getClassName() {
|
|
688
|
+
return "overlay fixed top-[0px] left-0 bottom-0 right-0 flex-col bg-background z-20 lg:z-10 flex flex-auto lg:left-[64px] lg:top-0 overflow-y-auto will-change-contents " + (this.class || "");
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* This will setup and render the component.
|
|
692
|
+
*
|
|
693
|
+
* @param {object} container
|
|
694
|
+
* @returns {void}
|
|
695
|
+
*/
|
|
696
|
+
setContainer(t) {
|
|
697
|
+
this.container = app.root;
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* This will setup the overlay states.
|
|
701
|
+
*
|
|
702
|
+
* @returns {object}
|
|
703
|
+
*/
|
|
704
|
+
setupStates() {
|
|
705
|
+
return {
|
|
706
|
+
loading: !1
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* This will set the loading state.= to true.
|
|
711
|
+
*
|
|
712
|
+
* @returns {void}
|
|
713
|
+
*/
|
|
714
|
+
addLoading() {
|
|
715
|
+
this.state.loading = !0;
|
|
716
|
+
}
|
|
717
|
+
/**
|
|
718
|
+
* This will set the loading state to false.
|
|
719
|
+
*
|
|
720
|
+
* @returns {void}
|
|
721
|
+
*/
|
|
722
|
+
removeLoading() {
|
|
723
|
+
this.state.loading = !1;
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* This will add the body of the overlay.
|
|
727
|
+
*
|
|
728
|
+
* @returns {object}
|
|
729
|
+
*/
|
|
730
|
+
addBody() {
|
|
731
|
+
return o({ class: "body fadeIn flex flex-auto flex-col" }, this.getContents());
|
|
732
|
+
}
|
|
733
|
+
/**
|
|
734
|
+
* This will get the body contents.
|
|
735
|
+
*
|
|
736
|
+
* @returns {array|null}
|
|
737
|
+
*/
|
|
738
|
+
getContents() {
|
|
739
|
+
return this.children;
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
class tt extends W {
|
|
743
|
+
constructor() {
|
|
744
|
+
super(...arguments);
|
|
745
|
+
/**
|
|
746
|
+
* @member {string} class
|
|
747
|
+
* @default ''
|
|
748
|
+
*/
|
|
749
|
+
l(this, "class", "");
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* This will stop presistence.
|
|
753
|
+
*
|
|
754
|
+
* @returns {void}
|
|
755
|
+
*/
|
|
756
|
+
onCreated() {
|
|
757
|
+
this.dockSize = this.maxSize || 1024;
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
* This will render the component.
|
|
761
|
+
*
|
|
762
|
+
* @returns {object}
|
|
763
|
+
*/
|
|
764
|
+
render() {
|
|
765
|
+
const t = this.container;
|
|
766
|
+
return o(
|
|
767
|
+
{
|
|
768
|
+
onState: [
|
|
769
|
+
["loading", {
|
|
770
|
+
loading: !0
|
|
771
|
+
}],
|
|
772
|
+
["docked", (n, a) => {
|
|
773
|
+
n ? (a.className = this.getDockedClassName(), t.appendChild(a), document.documentElement.style.overflowY = "auto") : (a.className = this.getClassName(), app.root.appendChild(a), document.documentElement.style.overflowY = "hidden");
|
|
774
|
+
}]
|
|
775
|
+
]
|
|
776
|
+
},
|
|
777
|
+
[
|
|
778
|
+
this.addBody()
|
|
779
|
+
]
|
|
780
|
+
);
|
|
781
|
+
}
|
|
782
|
+
/**
|
|
783
|
+
* This will get the docked className.
|
|
784
|
+
*
|
|
785
|
+
* @returns {string}
|
|
786
|
+
*/
|
|
787
|
+
getDockedClassName() {
|
|
788
|
+
return "flex flex-auto flex-col bg-background flex will-change-contents " + (this.class || "");
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* This will setup and render the component.
|
|
792
|
+
*
|
|
793
|
+
* @param {object} container
|
|
794
|
+
* @returns {void}
|
|
795
|
+
*/
|
|
796
|
+
setup(t) {
|
|
797
|
+
this.container = t, this.initialize();
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* This will setup the overlay states.
|
|
801
|
+
*
|
|
802
|
+
* @returns {object}
|
|
803
|
+
*/
|
|
804
|
+
setupStates() {
|
|
805
|
+
return {
|
|
806
|
+
loading: !1,
|
|
807
|
+
docked: this.canDock()
|
|
808
|
+
};
|
|
809
|
+
}
|
|
810
|
+
/**
|
|
811
|
+
* This will check the dock size.
|
|
812
|
+
*
|
|
813
|
+
* @returns {void}
|
|
814
|
+
*/
|
|
815
|
+
afterSetup() {
|
|
816
|
+
this.onResize();
|
|
817
|
+
}
|
|
818
|
+
/**
|
|
819
|
+
* This will setup the overlay events.
|
|
820
|
+
*
|
|
821
|
+
* @returns {Array<object>}
|
|
822
|
+
*/
|
|
823
|
+
setupEvents() {
|
|
824
|
+
return [
|
|
825
|
+
["resize", window, () => this.onResize()]
|
|
826
|
+
];
|
|
827
|
+
}
|
|
828
|
+
/**
|
|
829
|
+
* This will check if the overlay can dock.
|
|
830
|
+
*
|
|
831
|
+
* @returns {boolean}
|
|
832
|
+
*/
|
|
833
|
+
canDock() {
|
|
834
|
+
return window.innerWidth >= this.dockSize;
|
|
835
|
+
}
|
|
836
|
+
/**
|
|
837
|
+
* This will handle the overlay resize.
|
|
838
|
+
*
|
|
839
|
+
* @returns {void}
|
|
840
|
+
*/
|
|
841
|
+
onResize() {
|
|
842
|
+
this.state.docked = this.canDock();
|
|
843
|
+
}
|
|
844
|
+
/**
|
|
845
|
+
* This will resume scrolling when the overlay is being removed.
|
|
846
|
+
*
|
|
847
|
+
* @returns {void}
|
|
848
|
+
*/
|
|
849
|
+
beforeDestroy() {
|
|
850
|
+
document.documentElement.style.overflowY = "auto";
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
class st extends W {
|
|
854
|
+
constructor() {
|
|
855
|
+
super(...arguments);
|
|
856
|
+
/**
|
|
857
|
+
* @member {string} class
|
|
858
|
+
* @default ''
|
|
859
|
+
*/
|
|
860
|
+
l(this, "class", "");
|
|
861
|
+
}
|
|
862
|
+
/**
|
|
863
|
+
* This will get the overlay type.
|
|
864
|
+
*
|
|
865
|
+
* @returns {string}
|
|
866
|
+
*/
|
|
867
|
+
getClassName() {
|
|
868
|
+
return "overlay relative inline top-[0px] left-0 bottom-0 right-0 flex-col bg-background z-20 lg:left-[64px] lg:top-0 will-change-contents " + (this.class || "");
|
|
869
|
+
}
|
|
870
|
+
/**
|
|
871
|
+
* This will setup and render the component.
|
|
872
|
+
*
|
|
873
|
+
* @param {object} container
|
|
874
|
+
* @returns {void}
|
|
875
|
+
*/
|
|
876
|
+
setup(t) {
|
|
877
|
+
this.container = t, this.initialize();
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
const Se = u(({ index: e, click: s, state: t }, n) => D({
|
|
881
|
+
class: "p-2 cursor-pointer hover:bg-muted/50",
|
|
882
|
+
onState: [
|
|
883
|
+
[t, "selectedIndex", {
|
|
884
|
+
"bg-accent": e,
|
|
885
|
+
"text-white": e
|
|
886
|
+
}]
|
|
887
|
+
],
|
|
888
|
+
pointerdown: () => s(e)
|
|
889
|
+
}, n)), Le = u(({ selectOption: e, state: s }) => m({
|
|
890
|
+
class: "border rounded-md list-none m-0 p-0 max-h-[400px] overflow-y-auto",
|
|
891
|
+
for: ["filteredOptions", (t, n) => Se({ index: n, click: e, state: s }, t.label)]
|
|
892
|
+
})), Ce = 100, Oe = u((e) => o({ class: "relative flex items-center" }, [
|
|
893
|
+
X({
|
|
894
|
+
cache: "input",
|
|
895
|
+
placeholder: e.placeholder ?? "Search...",
|
|
896
|
+
bind: [e.state, "searchQuery"],
|
|
897
|
+
keyup: (s, t) => {
|
|
898
|
+
t.state.open = !0, typeof e.filterOptions == "function" && e.filterOptions(), t.dropdown.updatePosition();
|
|
899
|
+
},
|
|
900
|
+
pointerup: (s, t) => t.toggleDropdown(),
|
|
901
|
+
blur: (s, { state: t }) => setTimeout(() => t.open = !1, Ce),
|
|
902
|
+
keydown: (s) => typeof e.handleKeyDown == "function" && e.handleKeyDown(s)
|
|
903
|
+
}),
|
|
904
|
+
e.icon && o({ class: "absolute right-0 mr-2" }, [
|
|
905
|
+
N(e.icon)
|
|
906
|
+
])
|
|
907
|
+
])), Be = (e) => o({
|
|
908
|
+
class: "relative flex fle-auto flex-col",
|
|
909
|
+
onState: ["open", (s, t, n) => {
|
|
910
|
+
if (s)
|
|
911
|
+
return new ee({
|
|
912
|
+
cache: "dropdown",
|
|
913
|
+
parent: n,
|
|
914
|
+
button: n.input,
|
|
915
|
+
size: "xl"
|
|
916
|
+
}, [
|
|
917
|
+
Le(e)
|
|
918
|
+
]);
|
|
919
|
+
}]
|
|
920
|
+
}), nt = M(
|
|
921
|
+
{
|
|
922
|
+
/**
|
|
923
|
+
* This will set up the data object.
|
|
924
|
+
*
|
|
925
|
+
* @returns {object} - The data object.
|
|
926
|
+
*/
|
|
927
|
+
setData() {
|
|
928
|
+
const e = this.options || [];
|
|
929
|
+
return new L({
|
|
930
|
+
options: e,
|
|
931
|
+
filteredOptions: e
|
|
932
|
+
});
|
|
933
|
+
},
|
|
934
|
+
/**
|
|
935
|
+
* This will set up the state object.
|
|
936
|
+
*
|
|
937
|
+
* @returns {object} - The state object.
|
|
938
|
+
*/
|
|
939
|
+
state() {
|
|
940
|
+
return {
|
|
941
|
+
searchQuery: "",
|
|
942
|
+
selectedIndex: -1,
|
|
943
|
+
open: !1
|
|
944
|
+
};
|
|
945
|
+
},
|
|
946
|
+
/**
|
|
947
|
+
* This will set the selected index by query.
|
|
948
|
+
*
|
|
949
|
+
* @returns {void}
|
|
950
|
+
*/
|
|
951
|
+
setSelectedIndexByQuery() {
|
|
952
|
+
const e = this.data.filteredOptions;
|
|
953
|
+
let { searchQuery: s } = this.state;
|
|
954
|
+
s = s.toLowerCase();
|
|
955
|
+
const t = e.findIndex((n) => n.label.toLowerCase() === s);
|
|
956
|
+
t >= 0 && (this.state.selectedIndex = t);
|
|
957
|
+
},
|
|
958
|
+
/**
|
|
959
|
+
* This will filter the options.
|
|
960
|
+
*
|
|
961
|
+
* @returns {void}
|
|
962
|
+
*/
|
|
963
|
+
filterOptions() {
|
|
964
|
+
const e = this.state.searchQuery.toLowerCase();
|
|
965
|
+
if (e === "" || e.length === 0) {
|
|
966
|
+
this.data.filteredOptions = this.data.options;
|
|
967
|
+
return;
|
|
968
|
+
}
|
|
969
|
+
const s = this.data.get("options");
|
|
970
|
+
this.data.filteredOptions = s.filter(
|
|
971
|
+
(t) => t.label.toLowerCase().includes(e)
|
|
972
|
+
);
|
|
973
|
+
},
|
|
974
|
+
/**
|
|
975
|
+
* This will get the selected value.
|
|
976
|
+
*
|
|
977
|
+
* @returns {object}
|
|
978
|
+
*/
|
|
979
|
+
getValue() {
|
|
980
|
+
const { selectedIndex: e } = this.state;
|
|
981
|
+
return e < 0 ? null : this.data.get(`filteredOptions[${e}]`);
|
|
982
|
+
},
|
|
983
|
+
/**
|
|
984
|
+
* This will select an option.
|
|
985
|
+
*
|
|
986
|
+
* @param {number} index - The index of the option.
|
|
987
|
+
* @returns {void}
|
|
988
|
+
*/
|
|
989
|
+
selectOption(e) {
|
|
990
|
+
this.state.selectedIndex = e;
|
|
991
|
+
const s = this.data.get(`filteredOptions[${e}]`);
|
|
992
|
+
this.state.searchQuery = s.label, this.state.open = !1, typeof this.onSelect == "function" && this.onSelect(s);
|
|
993
|
+
},
|
|
994
|
+
/**
|
|
995
|
+
* Toggles the dropdown open state.
|
|
996
|
+
*/
|
|
997
|
+
toggleDropdown() {
|
|
998
|
+
this.state.toggle("open"), this.state.open && this.setSelectedIndexByQuery();
|
|
999
|
+
},
|
|
1000
|
+
/**
|
|
1001
|
+
* This will handle key down events.
|
|
1002
|
+
*
|
|
1003
|
+
* @param {object} event - The event object.
|
|
1004
|
+
* @returns {void}
|
|
1005
|
+
*/
|
|
1006
|
+
handleKeyDown(e) {
|
|
1007
|
+
const s = this.data.filteredOptions, { selectedIndex: t } = this.state;
|
|
1008
|
+
e.key === "ArrowDown" ? (e.preventDefault(), this.state.selectedIndex = Math.min(t + 1, s.length - 1)) : e.key === "ArrowUp" ? (e.preventDefault(), this.state.selectedIndex = Math.max(t - 1, 0)) : e.key === "Enter" && t >= 0 && (e.preventDefault(), this.selectOption(t));
|
|
1009
|
+
},
|
|
1010
|
+
/**
|
|
1011
|
+
* This will render the component.
|
|
1012
|
+
*
|
|
1013
|
+
* @returns {object} - The rendered component.
|
|
1014
|
+
*/
|
|
1015
|
+
render() {
|
|
1016
|
+
return o({ class: "relative w-full max-w-md" }, [
|
|
1017
|
+
Oe({
|
|
1018
|
+
// @ts-ignore
|
|
1019
|
+
state: this.state,
|
|
1020
|
+
// @ts-ignore
|
|
1021
|
+
icon: this.icon,
|
|
1022
|
+
// @ts-ignore
|
|
1023
|
+
placeholder: this.placeholder,
|
|
1024
|
+
// @ts-ignore
|
|
1025
|
+
filterOptions: this.filterOptions.bind(this),
|
|
1026
|
+
// @ts-ignore
|
|
1027
|
+
handleKeyDown: this.handleKeyDown.bind(this)
|
|
1028
|
+
}),
|
|
1029
|
+
Be({
|
|
1030
|
+
// @ts-ignore
|
|
1031
|
+
state: this.state,
|
|
1032
|
+
// @ts-ignore
|
|
1033
|
+
setSelected: this.setSelectedIndexByQuery.bind(this),
|
|
1034
|
+
// @ts-ignore
|
|
1035
|
+
selectOption: this.selectOption.bind(this)
|
|
1036
|
+
})
|
|
1037
|
+
]);
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
), Ie = (e) => D(
|
|
1041
|
+
{
|
|
1042
|
+
class: "inline-flex flex-auto items-center justify-center whitespace-nowrap rounded-sm 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-primary data-[state=active]:text-primary-foreground data-[state=active]:shadow-sm",
|
|
1043
|
+
dataSet: ["selected", ["state", e.value, "active"]]
|
|
1044
|
+
},
|
|
1045
|
+
[
|
|
1046
|
+
y({
|
|
1047
|
+
class: "flex flex-auto justify-center items-center px-3 py-1.5",
|
|
1048
|
+
onSet: ["selected", { selected: e.value }],
|
|
1049
|
+
click: (s) => e.callBack(e.value)
|
|
1050
|
+
}, e.label)
|
|
1051
|
+
]
|
|
1052
|
+
), Me = (e, s) => (e.callBack = s, Ie(e)), Re = (e) => S({ class: `tab items-center justify-center rounded-md bg-muted p-1 text-muted-foreground ${e.class}` }, [
|
|
1053
|
+
m({ class: "flex flex-auto flex-row", map: [e.options, (s) => Me(s, e.callBack)] })
|
|
1054
|
+
]);
|
|
1055
|
+
class at extends h {
|
|
1056
|
+
constructor() {
|
|
1057
|
+
super(...arguments);
|
|
1058
|
+
/**
|
|
1059
|
+
* This will set the options.
|
|
1060
|
+
* @member {array} options
|
|
1061
|
+
* @default []
|
|
1062
|
+
*/
|
|
1063
|
+
l(this, "options", []);
|
|
1064
|
+
/**
|
|
1065
|
+
* This will set the class.
|
|
1066
|
+
* @member {string} class
|
|
1067
|
+
* @default ''
|
|
1068
|
+
*/
|
|
1069
|
+
l(this, "class", "");
|
|
1070
|
+
/**
|
|
1071
|
+
* This will set the call back.
|
|
1072
|
+
* @member {function} callBack
|
|
1073
|
+
*/
|
|
1074
|
+
l(this, "callBack", null);
|
|
1075
|
+
}
|
|
1076
|
+
/**
|
|
1077
|
+
* This will render the component.
|
|
1078
|
+
*
|
|
1079
|
+
* @returns {object}
|
|
1080
|
+
*/
|
|
1081
|
+
render() {
|
|
1082
|
+
const t = this.select.bind(this);
|
|
1083
|
+
return o({ class: "" }, [
|
|
1084
|
+
Re({
|
|
1085
|
+
class: this.class,
|
|
1086
|
+
options: this.options,
|
|
1087
|
+
callBack: t
|
|
1088
|
+
}),
|
|
1089
|
+
I({
|
|
1090
|
+
class: "tab-content",
|
|
1091
|
+
onState: ["selected", this.updateContent.bind(this)]
|
|
1092
|
+
})
|
|
1093
|
+
]);
|
|
1094
|
+
}
|
|
1095
|
+
/**
|
|
1096
|
+
* This will get the first value.
|
|
1097
|
+
*
|
|
1098
|
+
* @returns {*}
|
|
1099
|
+
*/
|
|
1100
|
+
getFirstValue() {
|
|
1101
|
+
var t;
|
|
1102
|
+
return (t = this.options[0]) == null ? void 0 : t.value;
|
|
1103
|
+
}
|
|
1104
|
+
/**
|
|
1105
|
+
* This will update the component.
|
|
1106
|
+
*
|
|
1107
|
+
* @returns {void}
|
|
1108
|
+
*/
|
|
1109
|
+
update() {
|
|
1110
|
+
const t = this.state.get("selected");
|
|
1111
|
+
this.select(null), this.select(t);
|
|
1112
|
+
}
|
|
1113
|
+
/**
|
|
1114
|
+
* This will select a value.
|
|
1115
|
+
*
|
|
1116
|
+
* @param {*} value
|
|
1117
|
+
* @returns {void}
|
|
1118
|
+
*/
|
|
1119
|
+
select(t) {
|
|
1120
|
+
this.state.selected = t;
|
|
1121
|
+
}
|
|
1122
|
+
/**
|
|
1123
|
+
* This will update the content.
|
|
1124
|
+
*
|
|
1125
|
+
* @param {*} value
|
|
1126
|
+
* @returns {object}
|
|
1127
|
+
*/
|
|
1128
|
+
updateContent(t) {
|
|
1129
|
+
const n = this.options;
|
|
1130
|
+
if (!n || n.length < 1)
|
|
1131
|
+
return;
|
|
1132
|
+
const a = n[0];
|
|
1133
|
+
for (const i of n)
|
|
1134
|
+
if (i.value === t)
|
|
1135
|
+
return i.layout;
|
|
1136
|
+
return a.layout;
|
|
1137
|
+
}
|
|
1138
|
+
/**
|
|
1139
|
+
* This will setup the states.
|
|
1140
|
+
*
|
|
1141
|
+
* @returns {object}
|
|
1142
|
+
*/
|
|
1143
|
+
setupStates() {
|
|
1144
|
+
const t = this.callBack, n = typeof t;
|
|
1145
|
+
return {
|
|
1146
|
+
selected: {
|
|
1147
|
+
state: this.getFirstValue(),
|
|
1148
|
+
callBack(a) {
|
|
1149
|
+
n === "function" && t(a);
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
};
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
const Te = (e) => D(
|
|
1156
|
+
{
|
|
1157
|
+
class: "inline-flex flex-auto items-center justify-center whitespace-nowrap rounded-sm 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-primary data-[state=active]:text-primary-foreground data-[state=active]:shadow-sm",
|
|
1158
|
+
dataSet: ["selected", ["state", e.value, "active"]]
|
|
1159
|
+
},
|
|
1160
|
+
[
|
|
1161
|
+
y({
|
|
1162
|
+
class: "flex flex-auto justify-center items-center px-3 py-1.5 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
1163
|
+
onSet: ["selected", { selected: e.value }],
|
|
1164
|
+
click: (s) => e.callBack(e.value),
|
|
1165
|
+
disabled: e.disabled
|
|
1166
|
+
}, e.label)
|
|
1167
|
+
]
|
|
1168
|
+
), Ne = (e, s) => (e.callBack = s, Te(e)), We = (e) => S({ class: `tab items-center justify-center rounded-md bg-muted p-1 text-muted-foreground ${e.class}` }, [
|
|
1169
|
+
m({ class: "flex flex-auto flex-row", map: [e.options, (s) => Ne(s, e.callBack)] })
|
|
1170
|
+
]);
|
|
1171
|
+
class it extends h {
|
|
1172
|
+
constructor() {
|
|
1173
|
+
super(...arguments);
|
|
1174
|
+
/**
|
|
1175
|
+
* This will set the options.
|
|
1176
|
+
* @member {array} options
|
|
1177
|
+
* @default []
|
|
1178
|
+
*/
|
|
1179
|
+
l(this, "options", []);
|
|
1180
|
+
/**
|
|
1181
|
+
* This will set the class.
|
|
1182
|
+
* @member {string} class
|
|
1183
|
+
* @default ''
|
|
1184
|
+
*/
|
|
1185
|
+
l(this, "class", "");
|
|
1186
|
+
/**
|
|
1187
|
+
* This will set the on select call back.
|
|
1188
|
+
* @member {function} onSelect
|
|
1189
|
+
*/
|
|
1190
|
+
l(this, "onSelect", null);
|
|
1191
|
+
}
|
|
1192
|
+
/**
|
|
1193
|
+
* This will render the component.
|
|
1194
|
+
*
|
|
1195
|
+
* @returns {object}
|
|
1196
|
+
*/
|
|
1197
|
+
render() {
|
|
1198
|
+
const t = this.select.bind(this);
|
|
1199
|
+
return We({
|
|
1200
|
+
class: this.class,
|
|
1201
|
+
options: this.options,
|
|
1202
|
+
callBack: t
|
|
1203
|
+
});
|
|
1204
|
+
}
|
|
1205
|
+
/**
|
|
1206
|
+
* This will select a value.
|
|
1207
|
+
*
|
|
1208
|
+
* @param {*} value
|
|
1209
|
+
* @returns {void}
|
|
1210
|
+
*/
|
|
1211
|
+
select(t) {
|
|
1212
|
+
this.state.selected = t, typeof this.onSelect == "function" && this.onSelect(t, this.parent);
|
|
1213
|
+
}
|
|
1214
|
+
/**
|
|
1215
|
+
* This will setup the states.
|
|
1216
|
+
*
|
|
1217
|
+
* @returns {object}
|
|
1218
|
+
*/
|
|
1219
|
+
setupStates() {
|
|
1220
|
+
var t;
|
|
1221
|
+
return {
|
|
1222
|
+
selected: ((t = this.options[0]) == null ? void 0 : t.value) || null
|
|
1223
|
+
};
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
const $e = (e, s) => new RegExp(`${e}($|/|\\.).*`).test(s), Ae = (e, s) => {
|
|
1227
|
+
const t = e.getLinkPath();
|
|
1228
|
+
return e.exact ? s === t : $e(t, s);
|
|
1229
|
+
}, je = ({ text: e, href: s, exact: t }) => new R({
|
|
1230
|
+
text: e,
|
|
1231
|
+
href: s,
|
|
1232
|
+
exact: t,
|
|
1233
|
+
dataSet: ["selected", ["state", !0, "active"]],
|
|
1234
|
+
class: "inline-flex flex-auto items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 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-primary data-[state=active]:text-primary-foreground data-[state=active]:shadow-sm"
|
|
1235
|
+
});
|
|
1236
|
+
class Pe extends h {
|
|
1237
|
+
constructor() {
|
|
1238
|
+
super(...arguments);
|
|
1239
|
+
/**
|
|
1240
|
+
* This will set the options.
|
|
1241
|
+
* @member {array} options
|
|
1242
|
+
* @default []
|
|
1243
|
+
*/
|
|
1244
|
+
l(this, "options", []);
|
|
1245
|
+
/**
|
|
1246
|
+
* This will set the class.
|
|
1247
|
+
* @member {string} class
|
|
1248
|
+
* @default ''
|
|
1249
|
+
*/
|
|
1250
|
+
l(this, "class", "");
|
|
1251
|
+
/**
|
|
1252
|
+
* This will set the on select call back.
|
|
1253
|
+
* @member {function} onSelect
|
|
1254
|
+
*/
|
|
1255
|
+
l(this, "onSelect", null);
|
|
1256
|
+
}
|
|
1257
|
+
/**
|
|
1258
|
+
* This will configure the links.
|
|
1259
|
+
*/
|
|
1260
|
+
beforeSetup() {
|
|
1261
|
+
this.links = [];
|
|
1262
|
+
}
|
|
1263
|
+
/**
|
|
1264
|
+
* This will render the component.
|
|
1265
|
+
*
|
|
1266
|
+
* @returns {object}
|
|
1267
|
+
*/
|
|
1268
|
+
render() {
|
|
1269
|
+
return S({ class: `tab items-center justify-center rounded-md bg-muted p-1 text-muted-foreground ${this.class}` }, [
|
|
1270
|
+
m({
|
|
1271
|
+
class: "flex flex-auto flex-row",
|
|
1272
|
+
map: [this.options, (t) => this.addLink(t)],
|
|
1273
|
+
watch: {
|
|
1274
|
+
value: ["[[path]]", k.data],
|
|
1275
|
+
callBack: this.updateLinks.bind(this)
|
|
1276
|
+
}
|
|
1277
|
+
})
|
|
1278
|
+
]);
|
|
1279
|
+
}
|
|
1280
|
+
/**
|
|
1281
|
+
* This will update the links.
|
|
1282
|
+
*
|
|
1283
|
+
* @returns {void}
|
|
1284
|
+
*/
|
|
1285
|
+
afterSetup() {
|
|
1286
|
+
const t = k.data.path;
|
|
1287
|
+
this.updateLinks(t);
|
|
1288
|
+
}
|
|
1289
|
+
/**
|
|
1290
|
+
* This will update the links.
|
|
1291
|
+
*
|
|
1292
|
+
* @param {string} value
|
|
1293
|
+
* @returns {void}
|
|
1294
|
+
*/
|
|
1295
|
+
updateLinks(t) {
|
|
1296
|
+
let n = !1, a = this.links[0];
|
|
1297
|
+
this.deactivateAllLinks();
|
|
1298
|
+
for (const i of this.links)
|
|
1299
|
+
if (i.rendered !== !1 && (n = Ae(i, t), n === !0)) {
|
|
1300
|
+
this.updateLink(i, !0);
|
|
1301
|
+
break;
|
|
1302
|
+
}
|
|
1303
|
+
n !== !0 && a && this.updateLink(a, !0);
|
|
1304
|
+
}
|
|
1305
|
+
/**
|
|
1306
|
+
* This will deactivate all links.
|
|
1307
|
+
*
|
|
1308
|
+
* @returns {void}
|
|
1309
|
+
*/
|
|
1310
|
+
deactivateAllLinks() {
|
|
1311
|
+
for (const t of this.links)
|
|
1312
|
+
this.updateLink(t, !1);
|
|
1313
|
+
}
|
|
1314
|
+
/**
|
|
1315
|
+
* This will update the link.
|
|
1316
|
+
*
|
|
1317
|
+
* @param {object} link
|
|
1318
|
+
* @param {boolean} selected
|
|
1319
|
+
* @returns {void}
|
|
1320
|
+
*/
|
|
1321
|
+
updateLink(t, n) {
|
|
1322
|
+
t.update(n);
|
|
1323
|
+
}
|
|
1324
|
+
/**
|
|
1325
|
+
* This will add a link.
|
|
1326
|
+
*
|
|
1327
|
+
* @param {object} option
|
|
1328
|
+
* @returns {object}
|
|
1329
|
+
*/
|
|
1330
|
+
addLink({ label: t, href: n, exact: a }) {
|
|
1331
|
+
const i = je({ text: t, href: n, exact: a });
|
|
1332
|
+
return this.links.push(i), i;
|
|
1333
|
+
}
|
|
1334
|
+
/**
|
|
1335
|
+
* This will remove all the links.
|
|
1336
|
+
*
|
|
1337
|
+
* @returns {void}
|
|
1338
|
+
*/
|
|
1339
|
+
beforeDestroy() {
|
|
1340
|
+
this.links = [];
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
class ot extends h {
|
|
1344
|
+
constructor() {
|
|
1345
|
+
super(...arguments);
|
|
1346
|
+
/**
|
|
1347
|
+
* This will set the options.
|
|
1348
|
+
* @member {array} options
|
|
1349
|
+
* @default []
|
|
1350
|
+
*/
|
|
1351
|
+
l(this, "options", []);
|
|
1352
|
+
/**
|
|
1353
|
+
* This will set the class.
|
|
1354
|
+
* @member {string} class
|
|
1355
|
+
* @default ''
|
|
1356
|
+
*/
|
|
1357
|
+
l(this, "class", "");
|
|
1358
|
+
}
|
|
1359
|
+
/**
|
|
1360
|
+
* This will render the component.
|
|
1361
|
+
*
|
|
1362
|
+
* @returns {object}
|
|
1363
|
+
*/
|
|
1364
|
+
render() {
|
|
1365
|
+
return o({ class: "tab-panel" }, [
|
|
1366
|
+
new Pe({
|
|
1367
|
+
class: this.class,
|
|
1368
|
+
options: this.options
|
|
1369
|
+
}),
|
|
1370
|
+
I({
|
|
1371
|
+
class: "tab-content",
|
|
1372
|
+
switch: this.addGroup()
|
|
1373
|
+
})
|
|
1374
|
+
]);
|
|
1375
|
+
}
|
|
1376
|
+
/**
|
|
1377
|
+
* This will add the group.
|
|
1378
|
+
*
|
|
1379
|
+
* @returns {array}
|
|
1380
|
+
*/
|
|
1381
|
+
addGroup() {
|
|
1382
|
+
let t;
|
|
1383
|
+
const n = [], a = this.options;
|
|
1384
|
+
for (let i = 0, r = a.length; i < r; i++)
|
|
1385
|
+
t = a[i], n.push(
|
|
1386
|
+
{
|
|
1387
|
+
uri: t.uri || t.href,
|
|
1388
|
+
component: t.component,
|
|
1389
|
+
title: t.title || null,
|
|
1390
|
+
persist: !0
|
|
1391
|
+
}
|
|
1392
|
+
);
|
|
1393
|
+
return n;
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
export {
|
|
1397
|
+
et as B,
|
|
1398
|
+
de as C,
|
|
1399
|
+
fe as D,
|
|
1400
|
+
ue as H,
|
|
1401
|
+
st as I,
|
|
1402
|
+
Ze as N,
|
|
1403
|
+
W as O,
|
|
1404
|
+
_e as P,
|
|
1405
|
+
nt as S,
|
|
1406
|
+
he as T,
|
|
1407
|
+
we as U,
|
|
1408
|
+
qe as W,
|
|
1409
|
+
ae as a,
|
|
1410
|
+
C as b,
|
|
1411
|
+
se as c,
|
|
1412
|
+
Ge as d,
|
|
1413
|
+
Ve as e,
|
|
1414
|
+
oe as f,
|
|
1415
|
+
ne as g,
|
|
1416
|
+
re as h,
|
|
1417
|
+
ce as i,
|
|
1418
|
+
Je as j,
|
|
1419
|
+
Xe as k,
|
|
1420
|
+
tt as l,
|
|
1421
|
+
at as m,
|
|
1422
|
+
it as n,
|
|
1423
|
+
Pe as o,
|
|
1424
|
+
ot as p
|
|
1425
|
+
};
|