@base-framework/ui 1.0.231 → 1.0.233
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/{empty-state-2O1fITpG.js → empty-state-C4Pnrs-y.js} +367 -288
- package/dist/format-BueUWxwT.js +122 -0
- package/dist/{image-scaler-BQ7WdtlV.js → image-scaler-DNyRgMye.js} +103 -222
- package/dist/index.es.js +123 -121
- package/dist/molecules.es.js +29 -28
- package/dist/organisms.es.js +29 -29
- package/dist/range-calendar-ZAHrVCgV.js +825 -0
- package/dist/{signature-panel-B7ItSnD5.js → signature-panel-DhtJwt4P.js} +499 -814
- package/dist/types/components/molecules/date-time/date-range-picker.d.ts +10 -0
- package/dist/types/components/molecules/molecules.d.ts +1 -0
- package/dist/utils.es.js +5 -4
- package/package.json +1 -1
- package/dist/calendar-Bn55oWBo.js +0 -510
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { Button as
|
|
2
|
-
import { Atom as
|
|
3
|
-
import { B as
|
|
4
|
-
import { Icons as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
1
|
+
import { Button as k, Div as o, On as v, Span as D, Th as O, UseParent as F, I as E, Thead as Q, Tr as X, Table as L, P as p, Li as S, Time as q, Nav as I, Ul as w, Section as z, Canvas as K } from "@base-framework/atoms";
|
|
2
|
+
import { Atom as d, Component as h, Data as C, DateTime as G, router as y, NavLink as $, DataTracker as N, Jot as V, base as M, Dom as R } from "@base-framework/base";
|
|
3
|
+
import { B as T, I as _ } from "./buttons-Cm9etaEG.js";
|
|
4
|
+
import { Icons as x } from "./icons.es.js";
|
|
5
|
+
import { TableBody as J, DataTableBody as Z, ScrollableTableBody as ee, List as te, IntervalTimer as se } from "@base-framework/organisms";
|
|
6
|
+
import { C as ae, I as ie, H as ne } from "./inputs-CMjx5-IX.js";
|
|
7
|
+
import { A as oe, P as le } from "./range-calendar-ZAHrVCgV.js";
|
|
8
|
+
d((t, e) => ({
|
|
9
9
|
class: "flex items-center px-4 py-2",
|
|
10
|
-
...
|
|
11
|
-
children:
|
|
10
|
+
...t,
|
|
11
|
+
children: e
|
|
12
12
|
}));
|
|
13
|
-
|
|
13
|
+
d(({ value: t, label: e }) => k({
|
|
14
14
|
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",
|
|
15
|
-
onState: ["performance", { active:
|
|
16
|
-
dataSet: ["performance", ["state",
|
|
17
|
-
click: (s, { state: a }) => a.performance =
|
|
18
|
-
},
|
|
19
|
-
class
|
|
15
|
+
onState: ["performance", { active: t }],
|
|
16
|
+
dataSet: ["performance", ["state", t, "active"]],
|
|
17
|
+
click: (s, { state: a }) => a.performance = t
|
|
18
|
+
}, e));
|
|
19
|
+
class at extends h {
|
|
20
20
|
/**
|
|
21
21
|
* This will declare the props for the compiler.
|
|
22
22
|
*
|
|
@@ -34,77 +34,77 @@ class Me extends m {
|
|
|
34
34
|
return o({ class: this.class || "" }, this.children);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
return
|
|
37
|
+
const re = (t) => {
|
|
38
|
+
const e = new Date(t, 11, 31), s = new Date(t, 0, 1);
|
|
39
|
+
return e.getDay() === 4 || // December 31 is a Thursday
|
|
40
40
|
s.getDay() === 4;
|
|
41
|
-
},
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
const a =
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
return
|
|
41
|
+
}, ce = (t) => {
|
|
42
|
+
const e = new Date(t.valueOf()), s = (e.getDay() + 6) % 7;
|
|
43
|
+
e.setDate(e.getDate() - s + 3);
|
|
44
|
+
const a = e.getFullYear(), i = new Date(a, 0, 4);
|
|
45
|
+
i.setDate(i.getDate() - (i.getDay() + 6) % 7);
|
|
46
|
+
const n = Math.ceil((e - i) / 6048e5) + 1;
|
|
47
|
+
return n > 52 && !re(a) ? {
|
|
48
48
|
weekNumber: 1,
|
|
49
49
|
year: a + 1
|
|
50
50
|
} : {
|
|
51
|
-
weekNumber:
|
|
51
|
+
weekNumber: n,
|
|
52
52
|
year: a
|
|
53
53
|
};
|
|
54
|
-
},
|
|
54
|
+
}, de = (t, e, s) => {
|
|
55
55
|
if (s === 0) return [];
|
|
56
|
-
const a = new Date(
|
|
56
|
+
const a = new Date(t, e, 0).getDate();
|
|
57
57
|
return Array.from(
|
|
58
58
|
{ length: s },
|
|
59
|
-
(
|
|
59
|
+
(i, n) => new Date(t, e - 1, a - s + n + 1)
|
|
60
60
|
);
|
|
61
|
-
},
|
|
62
|
-
const s = new Date(
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
return
|
|
66
|
-
},
|
|
67
|
-
const s = new Date(
|
|
68
|
-
let
|
|
61
|
+
}, he = (t, e, s) => Array.from({ length: s }, (a, i) => new Date(t, e + 1, i + 1)), W = (t, e) => {
|
|
62
|
+
const s = new Date(e, 0, 4), a = (s.getDay() + 6) % 7, i = new Date(s);
|
|
63
|
+
i.setDate(s.getDate() - a);
|
|
64
|
+
const n = new Date(i);
|
|
65
|
+
return n.setDate(i.getDate() + (t - 1) * 7), n;
|
|
66
|
+
}, it = (t, e) => {
|
|
67
|
+
const s = new Date(t, e, 1).getDay(), a = new Date(t, e + 1, 0).getDate(), i = [];
|
|
68
|
+
let n = [];
|
|
69
69
|
for (let l = 1 - s; l <= a; l++) {
|
|
70
|
-
const
|
|
71
|
-
|
|
70
|
+
const u = new Date(t, e, l);
|
|
71
|
+
n.push(l > 0 ? u : null), (n.length === 7 || l === a) && (i.push([...n]), n = []);
|
|
72
72
|
}
|
|
73
|
-
return
|
|
74
|
-
},
|
|
75
|
-
const s = new Date(
|
|
76
|
-
let
|
|
77
|
-
for (let
|
|
78
|
-
|
|
79
|
-
return
|
|
80
|
-
},
|
|
73
|
+
return i;
|
|
74
|
+
}, nt = (t, e) => {
|
|
75
|
+
const s = new Date(t, e + 1, 0).getDate(), a = [];
|
|
76
|
+
let i = [];
|
|
77
|
+
for (let n = 1; n <= s; n++)
|
|
78
|
+
i.push(new Date(t, e, n)), i.length === 7 && (a.push(i), i = []);
|
|
79
|
+
return i.length > 0 && a.push(i), a;
|
|
80
|
+
}, ue = (t, e, s) => {
|
|
81
81
|
const a = /* @__PURE__ */ new Date();
|
|
82
|
-
return a.getDate() ===
|
|
83
|
-
},
|
|
84
|
-
const
|
|
85
|
-
return
|
|
86
|
-
text:
|
|
87
|
-
disabled: !
|
|
82
|
+
return a.getDate() === t && a.getMonth() === e && a.getFullYear() === s;
|
|
83
|
+
}, fe = ({ day: t, month: e, year: s, weekNumber: a, selectWeek: i }) => {
|
|
84
|
+
const n = ue(t, e, s);
|
|
85
|
+
return k({
|
|
86
|
+
text: t || "",
|
|
87
|
+
disabled: !t,
|
|
88
88
|
class: `
|
|
89
89
|
px-2 py-1 text-center rounded-md
|
|
90
|
-
${
|
|
90
|
+
${n ? "bg-accent text-accent-foreground" : ""}
|
|
91
91
|
hover:bg-primary hover:text-primary-foreground
|
|
92
92
|
`,
|
|
93
|
-
click: () =>
|
|
93
|
+
click: () => i(a, s)
|
|
94
94
|
});
|
|
95
|
-
},
|
|
96
|
-
const s = new Date(
|
|
97
|
-
for (let
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
weekNumber:
|
|
101
|
-
year:
|
|
102
|
-
days:
|
|
95
|
+
}, ge = (t, e) => {
|
|
96
|
+
const s = new Date(t, e, 1).getDay(), a = new Date(t, e + 1, 0).getDate(), i = de(t, e, s), n = Array.from({ length: a }, (r, m) => new Date(t, e, m + 1)), l = (i.length + n.length) % 7, u = l === 0 ? 0 : 7 - l, c = he(t, e, u), f = [...i, ...n, ...c], g = [];
|
|
97
|
+
for (let r = 0; r < f.length; r += 7) {
|
|
98
|
+
const m = f.slice(r, r + 7), b = m.find((H) => H) || new Date(t, e, 1), { weekNumber: U, year: Y } = ce(b);
|
|
99
|
+
g.push({
|
|
100
|
+
weekNumber: U,
|
|
101
|
+
year: Y,
|
|
102
|
+
days: m
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
|
-
return
|
|
106
|
-
},
|
|
107
|
-
const { year:
|
|
105
|
+
return g;
|
|
106
|
+
}, me = ({ selectWeek: t }) => v("month", (e, s, { data: a }) => {
|
|
107
|
+
const { year: i, month: n, currentDate: l } = a, u = ge(i, n);
|
|
108
108
|
return o(
|
|
109
109
|
{ class: "grid grid-cols-8 gap-1 text-sm px-4 py-2" },
|
|
110
110
|
[
|
|
@@ -115,12 +115,12 @@ const vt = (e) => {
|
|
|
115
115
|
class: "grid grid-cols-7 col-span-7 text-center text-muted-foreground items-center"
|
|
116
116
|
},
|
|
117
117
|
["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map(
|
|
118
|
-
(c) =>
|
|
118
|
+
(c) => D({ class: "px-1 py-1", text: c })
|
|
119
119
|
)
|
|
120
120
|
),
|
|
121
121
|
// Render each "week" row
|
|
122
|
-
...
|
|
123
|
-
({ weekNumber: c, days:
|
|
122
|
+
...u.map(
|
|
123
|
+
({ weekNumber: c, days: f, year: g }) => o({
|
|
124
124
|
class: "grid grid-cols-8 col-span-8 items-center ring-primary rounded-sm px-1",
|
|
125
125
|
onSet: ["currentWeek", {
|
|
126
126
|
ring: c
|
|
@@ -129,7 +129,7 @@ const vt = (e) => {
|
|
|
129
129
|
// Left column: ISO week number
|
|
130
130
|
o({
|
|
131
131
|
class: "font-medium text-center col-span-1 rounded-sm cursor-pointer",
|
|
132
|
-
click: () =>
|
|
132
|
+
click: () => t(c, g),
|
|
133
133
|
// If you have a 'currentWeek' state, you can highlight it with 'onSet'
|
|
134
134
|
onSet: ["currentWeek", {
|
|
135
135
|
"text-primary-foreground": c,
|
|
@@ -140,13 +140,13 @@ const vt = (e) => {
|
|
|
140
140
|
// The 7 cells for each day in the row
|
|
141
141
|
o(
|
|
142
142
|
{ class: "grid grid-cols-7 col-span-7 text-center" },
|
|
143
|
-
|
|
144
|
-
(
|
|
145
|
-
year: (
|
|
146
|
-
month: (
|
|
147
|
-
day: (
|
|
143
|
+
f.map(
|
|
144
|
+
(r) => fe({
|
|
145
|
+
year: (r == null ? void 0 : r.getFullYear()) || null,
|
|
146
|
+
month: (r == null ? void 0 : r.getMonth()) || null,
|
|
147
|
+
day: (r == null ? void 0 : r.getDate()) || null,
|
|
148
148
|
weekNumber: c,
|
|
149
|
-
selectWeek:
|
|
149
|
+
selectWeek: t
|
|
150
150
|
})
|
|
151
151
|
)
|
|
152
152
|
)
|
|
@@ -154,31 +154,31 @@ const vt = (e) => {
|
|
|
154
154
|
)
|
|
155
155
|
]
|
|
156
156
|
);
|
|
157
|
-
}),
|
|
157
|
+
}), P = ({ label: t, click: e }) => T(
|
|
158
158
|
{
|
|
159
159
|
class: `
|
|
160
160
|
inline-flex items-center justify-center h-7 w-7 bg-transparent p-0
|
|
161
161
|
opacity-50 hover:opacity-100 text-muted-foreground absolute
|
|
162
|
-
${
|
|
162
|
+
${t === "Previous" ? "left-1" : "right-1"}
|
|
163
163
|
focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2
|
|
164
164
|
`,
|
|
165
|
-
click:
|
|
166
|
-
"aria-label": `${
|
|
165
|
+
click: e,
|
|
166
|
+
"aria-label": `${t} month`,
|
|
167
167
|
variant: "icon",
|
|
168
|
-
icon:
|
|
168
|
+
icon: t === "Previous" ? x.chevron.single.left : x.chevron.single.right
|
|
169
169
|
}
|
|
170
|
-
),
|
|
171
|
-
|
|
172
|
-
|
|
170
|
+
), pe = ({ next: t, previous: e }) => o({ class: "flex flex-auto min-h-12 text-sm font-medium relative justify-center items-center" }, [
|
|
171
|
+
D("[[monthName]] [[year]]"),
|
|
172
|
+
P({
|
|
173
173
|
label: "Previous",
|
|
174
|
-
click:
|
|
174
|
+
click: e
|
|
175
175
|
}),
|
|
176
|
-
|
|
176
|
+
P({
|
|
177
177
|
label: "Next",
|
|
178
|
-
click:
|
|
178
|
+
click: t
|
|
179
179
|
})
|
|
180
180
|
]);
|
|
181
|
-
class
|
|
181
|
+
class ot extends h {
|
|
182
182
|
/**
|
|
183
183
|
* This will declare the props for the compiler.
|
|
184
184
|
*
|
|
@@ -193,8 +193,8 @@ class Be extends m {
|
|
|
193
193
|
* @returns {Data}
|
|
194
194
|
*/
|
|
195
195
|
setData() {
|
|
196
|
-
const
|
|
197
|
-
return new
|
|
196
|
+
const e = /* @__PURE__ */ new Date(), s = this.selectedWeek || this.calculateCurrentWeek(e), a = W(s, e.getFullYear());
|
|
197
|
+
return new C({
|
|
198
198
|
monthName: this.getMonthName(a.getMonth()),
|
|
199
199
|
year: a.getFullYear(),
|
|
200
200
|
month: a.getMonth(),
|
|
@@ -208,8 +208,8 @@ class Be extends m {
|
|
|
208
208
|
* @param {Date} today
|
|
209
209
|
* @returns {Date}
|
|
210
210
|
*/
|
|
211
|
-
getSelectedDate(
|
|
212
|
-
const s = this.selectedDate ? new Date(this.selectedDate) :
|
|
211
|
+
getSelectedDate(e) {
|
|
212
|
+
const s = this.selectedDate ? new Date(this.selectedDate) : e;
|
|
213
213
|
return new Date(s.getFullYear(), s.getMonth(), s.getDate());
|
|
214
214
|
}
|
|
215
215
|
/**
|
|
@@ -218,11 +218,11 @@ class Be extends m {
|
|
|
218
218
|
* @param {Date} date
|
|
219
219
|
* @returns {number}
|
|
220
220
|
*/
|
|
221
|
-
calculateCurrentWeek(
|
|
222
|
-
const s = new Date(
|
|
221
|
+
calculateCurrentWeek(e) {
|
|
222
|
+
const s = new Date(e.valueOf()), a = (e.getDay() + 6) % 7;
|
|
223
223
|
s.setDate(s.getDate() - a + 3);
|
|
224
|
-
const
|
|
225
|
-
return s.setMonth(0, 1), s.getDay() !== 4 && s.setMonth(0, 1 + (4 - s.getDay() + 7) % 7), 1 + Math.ceil((
|
|
224
|
+
const i = s.valueOf();
|
|
225
|
+
return s.setMonth(0, 1), s.getDay() !== 4 && s.setMonth(0, 1 + (4 - s.getDay() + 7) % 7), 1 + Math.ceil((i - s) / 6048e5);
|
|
226
226
|
}
|
|
227
227
|
/**
|
|
228
228
|
* Gets the name of the month.
|
|
@@ -230,8 +230,8 @@ class Be extends m {
|
|
|
230
230
|
* @param {number} month
|
|
231
231
|
* @returns {string}
|
|
232
232
|
*/
|
|
233
|
-
getMonthName(
|
|
234
|
-
return
|
|
233
|
+
getMonthName(e) {
|
|
234
|
+
return G.monthNames[e];
|
|
235
235
|
}
|
|
236
236
|
/**
|
|
237
237
|
* Updates the calendar to show the previous month.
|
|
@@ -239,8 +239,8 @@ class Be extends m {
|
|
|
239
239
|
* @returns {void}
|
|
240
240
|
*/
|
|
241
241
|
goToPreviousMonth() {
|
|
242
|
-
const
|
|
243
|
-
let { year: s, month: a } =
|
|
242
|
+
const e = this.data;
|
|
243
|
+
let { year: s, month: a } = e;
|
|
244
244
|
a === 0 ? (a = 11, s--) : a--, this.setDate(a, s);
|
|
245
245
|
}
|
|
246
246
|
/**
|
|
@@ -249,8 +249,8 @@ class Be extends m {
|
|
|
249
249
|
* @returns {void}
|
|
250
250
|
*/
|
|
251
251
|
goToNextMonth() {
|
|
252
|
-
const
|
|
253
|
-
let { year: s, month: a } =
|
|
252
|
+
const e = this.data;
|
|
253
|
+
let { year: s, month: a } = e;
|
|
254
254
|
a === 11 ? (a = 0, s++) : a++, this.setDate(a, s);
|
|
255
255
|
}
|
|
256
256
|
/**
|
|
@@ -261,11 +261,11 @@ class Be extends m {
|
|
|
261
261
|
* @param {number|null} [date=null]
|
|
262
262
|
* @returns {void}
|
|
263
263
|
*/
|
|
264
|
-
setDate(
|
|
264
|
+
setDate(e, s, a) {
|
|
265
265
|
this.data.set({
|
|
266
266
|
year: s,
|
|
267
|
-
month:
|
|
268
|
-
monthName: this.getMonthName(
|
|
267
|
+
month: e,
|
|
268
|
+
monthName: this.getMonthName(e)
|
|
269
269
|
}), a && (this.data.currentDate = a);
|
|
270
270
|
}
|
|
271
271
|
/**
|
|
@@ -274,10 +274,10 @@ class Be extends m {
|
|
|
274
274
|
* @param {number} weekNumber
|
|
275
275
|
* @returns {void}
|
|
276
276
|
*/
|
|
277
|
-
selectWeek(
|
|
278
|
-
this.data.currentWeek =
|
|
279
|
-
const a =
|
|
280
|
-
this.setDate(a.getMonth(), a.getFullYear(), a.getDate()), typeof this.selectedCallBack == "function" && this.selectedCallBack(
|
|
277
|
+
selectWeek(e, s) {
|
|
278
|
+
this.data.currentWeek = e;
|
|
279
|
+
const a = W(e, s);
|
|
280
|
+
this.setDate(a.getMonth(), a.getFullYear(), a.getDate()), typeof this.selectedCallBack == "function" && this.selectedCallBack(e);
|
|
281
281
|
}
|
|
282
282
|
/**
|
|
283
283
|
* Renders the WeekCalendar component.
|
|
@@ -286,380 +286,66 @@ class Be extends m {
|
|
|
286
286
|
*/
|
|
287
287
|
render() {
|
|
288
288
|
return o({ class: "week-calendar-container border rounded-md bg-background p-3" }, [
|
|
289
|
-
|
|
289
|
+
pe({
|
|
290
290
|
next: () => this.goToNextMonth(),
|
|
291
291
|
previous: () => this.goToPreviousMonth()
|
|
292
292
|
}),
|
|
293
|
-
|
|
294
|
-
selectWeek: (
|
|
293
|
+
me({
|
|
294
|
+
selectWeek: (e, s) => this.selectWeek(e, s)
|
|
295
295
|
})
|
|
296
296
|
]);
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
|
-
const
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
variant: "icon",
|
|
310
|
-
icon: e === "Previous" ? v.chevron.single.left : v.chevron.single.right
|
|
311
|
-
}
|
|
312
|
-
), Rt = ({ onMonthClick: e, onYearClick: t, next: s, previous: a }) => o({ class: "flex items-center justify-center space-x-2 relative min-h-12 text-sm font-medium" }, [
|
|
313
|
-
p({ click: e, variant: "ghost", "aria-label": "Select month" }, "[[monthName]]"),
|
|
314
|
-
p({ click: t, variant: "ghost", "aria-label": "Select year" }, "[[current.year]]"),
|
|
315
|
-
K({ label: "Previous", click: a }),
|
|
316
|
-
K({ label: "Next", click: s })
|
|
317
|
-
]), Ot = (e) => o({ class: "h-9 flex items-center justify-center font-medium" }, e), Pt = () => o(
|
|
318
|
-
{ class: "grid grid-cols-7 gap-1 text-center text-xs font-medium text-muted-foreground mb-2" },
|
|
319
|
-
["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map(Ot)
|
|
320
|
-
), $t = ({ day: e, iso: t, disabled: s, isStart: a, isEnd: n, isBetween: i, isOtherMonth: l, click: r }) => {
|
|
321
|
-
let c = "ghost", h = "";
|
|
322
|
-
return a || n ? (c = "default", h = "bg-primary text-primary-foreground hover:bg-primary/90") : i && (h = "bg-accent text-accent-foreground hover:bg-accent/80"), s && (h += " opacity-50 cursor-not-allowed"), l && (h += " text-muted-foreground opacity-50"), p(
|
|
323
|
-
{
|
|
324
|
-
class: `flex items-center justify-center p-0 text-sm font-medium rounded-md transition-colors ${h}`,
|
|
325
|
-
variant: c,
|
|
326
|
-
disabled: s,
|
|
327
|
-
click: () => {
|
|
328
|
-
s || r();
|
|
329
|
-
}
|
|
330
|
-
},
|
|
331
|
-
e.toString()
|
|
332
|
-
);
|
|
333
|
-
}, Wt = ({ today: e, current: t, blockPriorDates: s, onDateClick: a }) => {
|
|
334
|
-
const { start: n, end: i } = t, l = new Date(t.year, t.month, 1).getDay(), r = new Date(t.year, t.month + 1, 0).getDate(), c = [], h = t.month === 0 ? 11 : t.month - 1, y = t.month === 0 ? t.year - 1 : t.year, u = new Date(y, h + 1, 0).getDate(), b = t.month === 11 ? 0 : t.month + 1, x = t.month === 11 ? t.year + 1 : t.year;
|
|
335
|
-
for (let d = l - 1; d >= 0; d--) {
|
|
336
|
-
const f = u - d, w = Y(y, h, f), D = new Date(y, h, f), S = new Date(e.year, e.month, e.date), C = D < S, I = s && C, M = n === w, L = i === w, st = n && i && w > n && w < i;
|
|
337
|
-
c.push({
|
|
338
|
-
day: f,
|
|
339
|
-
iso: w,
|
|
340
|
-
disabled: I,
|
|
341
|
-
isStart: M,
|
|
342
|
-
isEnd: L,
|
|
343
|
-
isBetween: st,
|
|
344
|
-
isOtherMonth: !0,
|
|
345
|
-
click: () => a(w)
|
|
346
|
-
});
|
|
347
|
-
}
|
|
348
|
-
for (let d = 1; d <= r; d++) {
|
|
349
|
-
const f = Y(t.year, t.month, d), w = new Date(t.year, t.month, d), D = new Date(e.year, e.month, e.date), S = w < D, C = s && S, I = n === f, M = i === f, L = n && i && f > n && f < i;
|
|
350
|
-
c.push({
|
|
351
|
-
day: d,
|
|
352
|
-
iso: f,
|
|
353
|
-
disabled: C,
|
|
354
|
-
isStart: I,
|
|
355
|
-
isEnd: M,
|
|
356
|
-
isBetween: L,
|
|
357
|
-
isOtherMonth: !1,
|
|
358
|
-
click: () => {
|
|
359
|
-
console.log(f), a(f);
|
|
360
|
-
}
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
const z = 42 - c.length;
|
|
364
|
-
for (let d = 1; d <= z; d++) {
|
|
365
|
-
const f = Y(x, b, d), w = new Date(x, b, d), D = new Date(e.year, e.month, e.date), S = w < D, C = s && S, I = n === f, M = i === f, L = n && i && f > n && f < i;
|
|
366
|
-
c.push({
|
|
367
|
-
day: d,
|
|
368
|
-
iso: f,
|
|
369
|
-
disabled: C,
|
|
370
|
-
isStart: I,
|
|
371
|
-
isEnd: M,
|
|
372
|
-
isBetween: L,
|
|
373
|
-
isOtherMonth: !0,
|
|
374
|
-
click: () => a(f)
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
return o(
|
|
378
|
-
{ class: "grid grid-cols-7 gap-1" },
|
|
379
|
-
c.map(
|
|
380
|
-
(d, f) => $t({
|
|
381
|
-
day: d.day,
|
|
382
|
-
iso: d.iso,
|
|
383
|
-
disabled: d.disabled,
|
|
384
|
-
isStart: d.isStart,
|
|
385
|
-
isEnd: d.isEnd,
|
|
386
|
-
isBetween: d.isBetween,
|
|
387
|
-
isOtherMonth: d.isOtherMonth,
|
|
388
|
-
click: d.click
|
|
389
|
-
})
|
|
390
|
-
)
|
|
391
|
-
);
|
|
392
|
-
}, Nt = g((e, t) => o({ class: "flex flex-auto flex-col" }, [
|
|
393
|
-
Rt({
|
|
394
|
-
onMonthClick: e.onMonthClick,
|
|
395
|
-
onYearClick: e.onYearClick,
|
|
396
|
-
next: e.next,
|
|
397
|
-
previous: e.previous
|
|
398
|
-
}),
|
|
399
|
-
o({
|
|
400
|
-
class: "flex flex-auto flex-col w-full",
|
|
401
|
-
onSet: [
|
|
402
|
-
"currentDate",
|
|
403
|
-
() => [
|
|
404
|
-
Pt(),
|
|
405
|
-
Wt({
|
|
406
|
-
today: e.today,
|
|
407
|
-
current: e.current,
|
|
408
|
-
blockPriorDates: e.blockPriorDates,
|
|
409
|
-
onDateClick: e.onDateClick
|
|
410
|
-
})
|
|
411
|
-
]
|
|
412
|
-
]
|
|
413
|
-
})
|
|
414
|
-
])), jt = ({ currentMonth: e, currentYear: t, onSelect: s }) => o(
|
|
415
|
-
{ class: "grid grid-cols-3 gap-2" },
|
|
416
|
-
F.monthNames.map(
|
|
417
|
-
(a, n) => p(
|
|
418
|
-
{
|
|
419
|
-
click: (i) => {
|
|
420
|
-
i.preventDefault(), i.stopPropagation(), s(n);
|
|
421
|
-
},
|
|
422
|
-
variant: e === n ? "primary" : "ghost",
|
|
423
|
-
"aria-label": `Select ${a} ${t}`
|
|
424
|
-
},
|
|
425
|
-
a.substring(0, 3)
|
|
426
|
-
)
|
|
427
|
-
)
|
|
428
|
-
), zt = ({ start: e, end: t, selecting: s, onSelectStart: a, onSelectEnd: n }) => o({ class: "flex space-x-2 mb-4" }, [
|
|
429
|
-
k("selecting", (i) => p({
|
|
430
|
-
click: a,
|
|
431
|
-
variant: i === "start" ? "primary" : "outline",
|
|
432
|
-
class: "flex-1"
|
|
433
|
-
}, [
|
|
434
|
-
o({ class: "font-medium" }, G("current.start", "Start Date"))
|
|
435
|
-
])),
|
|
436
|
-
k("selecting", (i) => p({
|
|
437
|
-
click: n,
|
|
438
|
-
variant: i === "end" ? "primary" : "outline",
|
|
439
|
-
class: "flex-1"
|
|
440
|
-
}, [
|
|
441
|
-
o({ class: "font-medium" }, G("current.end", "End Date"))
|
|
442
|
-
]))
|
|
443
|
-
]), G = (e, t) => [`[[${e}]]`, (s) => s == null ? t : Yt(s)], Yt = (e) => {
|
|
444
|
-
const t = /* @__PURE__ */ new Date(e + "T00:00:00"), s = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], a = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
445
|
-
return `${s[t.getDay()]}, ${t.getDate()} ${a[t.getMonth()]}`;
|
|
446
|
-
}, At = ({ currentYear: e, onSelect: t }) => {
|
|
447
|
-
const s = e - 50, a = Array.from({ length: 101 }, (n, i) => s + i);
|
|
448
|
-
return o(
|
|
449
|
-
{ class: "grid grid-cols-4 gap-2 overflow-y-auto max-h-72" },
|
|
450
|
-
a.map(
|
|
451
|
-
(n) => p(
|
|
452
|
-
{
|
|
453
|
-
click: (i) => {
|
|
454
|
-
i.preventDefault(), i.stopPropagation(), t(n);
|
|
455
|
-
},
|
|
456
|
-
variant: n === e ? "primary" : "ghost",
|
|
457
|
-
"aria-label": `Select ${n}`
|
|
458
|
-
},
|
|
459
|
-
n.toString()
|
|
460
|
-
)
|
|
461
|
-
)
|
|
462
|
-
);
|
|
463
|
-
};
|
|
464
|
-
class Re extends m {
|
|
465
|
-
/**
|
|
466
|
-
* Declare compiler props.
|
|
467
|
-
*
|
|
468
|
-
* @returns {void}
|
|
469
|
-
*/
|
|
470
|
-
declareProps() {
|
|
471
|
-
this.startDate = null, this.endDate = null, this.onRangeSelect = null, this.blockPriorDates = !1;
|
|
472
|
-
}
|
|
473
|
-
/**
|
|
474
|
-
* Initialize reactive data for today and current view.
|
|
475
|
-
*
|
|
476
|
-
* @returns {Data}
|
|
477
|
-
*/
|
|
478
|
-
setData() {
|
|
479
|
-
const t = /* @__PURE__ */ new Date(), s = this.startDate ? /* @__PURE__ */ new Date(this.startDate + "T00:00:00") : t, a = s.getMonth(), n = s.getFullYear();
|
|
480
|
-
return new j({
|
|
481
|
-
today: {
|
|
482
|
-
date: t.getDate(),
|
|
483
|
-
month: t.getMonth(),
|
|
484
|
-
year: t.getFullYear()
|
|
485
|
-
},
|
|
486
|
-
monthName: this.getMonthName(a),
|
|
487
|
-
currentData: `${s.getFullYear()}-${R(s.getMonth() + 1)}-${R(s.getDate())}`,
|
|
488
|
-
current: {
|
|
489
|
-
date: t.getDate(),
|
|
490
|
-
month: a,
|
|
491
|
-
year: n,
|
|
492
|
-
start: this.startDate,
|
|
493
|
-
end: this.endDate
|
|
494
|
-
},
|
|
495
|
-
selecting: "start"
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
|
-
/**
|
|
499
|
-
* This will get the name of the month.
|
|
500
|
-
*
|
|
501
|
-
* @param {number} month
|
|
502
|
-
* @returns {string}
|
|
503
|
-
*/
|
|
504
|
-
getMonthName(t) {
|
|
505
|
-
return F.monthNames[t];
|
|
506
|
-
}
|
|
507
|
-
/**
|
|
508
|
-
* Initialize component state.
|
|
509
|
-
*
|
|
510
|
-
* @returns {{view:string}}
|
|
511
|
-
*/
|
|
512
|
-
setupStates() {
|
|
513
|
-
return {
|
|
514
|
-
view: "calendar"
|
|
515
|
-
// 'calendar', 'months', or 'years'
|
|
516
|
-
};
|
|
517
|
-
}
|
|
518
|
-
/**
|
|
519
|
-
* Handle a date cell click.
|
|
520
|
-
*
|
|
521
|
-
* @param {string} isoDate
|
|
522
|
-
* @returns {void}
|
|
523
|
-
*/
|
|
524
|
-
handleClick(t) {
|
|
525
|
-
if (this.data.selecting === "start") {
|
|
526
|
-
this.data.current.start = t, this.data.current.end = null, this.data.selecting = "end";
|
|
527
|
-
const s = new Date(t);
|
|
528
|
-
console.log(s.getMonth(), s.getFullYear(), s.getDate()), this.setCurrent({
|
|
529
|
-
month: s.getMonth(),
|
|
530
|
-
year: s.getFullYear(),
|
|
531
|
-
date: s.getDate()
|
|
532
|
-
});
|
|
533
|
-
} else {
|
|
534
|
-
this.data.current.start && t < this.data.current.start ? (this.data.current.end = this.data.current.start, this.data.current.start = t) : this.data.current.end = t, this.data.selecting = "start";
|
|
535
|
-
const s = new Date(t);
|
|
536
|
-
this.setCurrent({
|
|
537
|
-
month: s.getMonth(),
|
|
538
|
-
year: s.getFullYear(),
|
|
539
|
-
date: s.getDate()
|
|
540
|
-
}), typeof this.onRangeSelect == "function" && this.onRangeSelect(this.data.current.start, this.data.current.end);
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
/**
|
|
544
|
-
* Update current month/year in data.
|
|
545
|
-
*
|
|
546
|
-
* @param {object} obj
|
|
547
|
-
* @returns {void}
|
|
548
|
-
*/
|
|
549
|
-
setCurrent({ month: t, year: s, date: a = null }) {
|
|
550
|
-
const n = this.data.current;
|
|
551
|
-
n.month = (t + 12) % 12, n.year = s + (t < 0 ? -1 : t > 11 ? 1 : 0), a !== null && (n.date = a), this.data.monthName = this.getMonthName(n.month), this.data.currentDate = `${s}-${R(t + 1)}-${R(n.date)}`;
|
|
552
|
-
}
|
|
553
|
-
/**
|
|
554
|
-
* Render the range calendar.
|
|
555
|
-
*
|
|
556
|
-
* @returns {object}
|
|
557
|
-
*/
|
|
558
|
-
render() {
|
|
559
|
-
const { today: t, current: s, selecting: a } = this.data, { start: n, end: i } = s;
|
|
560
|
-
return o({ class: "range-calendar bg-background border border-border rounded-lg shadow-md p-4 w-full max-w-sm" }, [
|
|
561
|
-
zt({
|
|
562
|
-
start: n,
|
|
563
|
-
end: i,
|
|
564
|
-
selecting: a,
|
|
565
|
-
onSelectStart: () => this.data.selecting = "start",
|
|
566
|
-
onSelectEnd: () => this.data.selecting = "end"
|
|
567
|
-
}),
|
|
568
|
-
at("view", (l) => {
|
|
569
|
-
switch (l) {
|
|
570
|
-
case "months":
|
|
571
|
-
return jt(
|
|
572
|
-
{
|
|
573
|
-
currentMonth: s.month,
|
|
574
|
-
currentYear: s.year,
|
|
575
|
-
onSelect: (r) => {
|
|
576
|
-
this.setCurrent({ month: r, year: s.year }), this.state.view = "calendar";
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
);
|
|
580
|
-
case "years":
|
|
581
|
-
return At(
|
|
582
|
-
{
|
|
583
|
-
currentYear: s.year,
|
|
584
|
-
onSelect: (r) => {
|
|
585
|
-
this.setCurrent({ month: s.month, year: r }), this.state.view = "calendar";
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
);
|
|
589
|
-
default:
|
|
590
|
-
return Nt({
|
|
591
|
-
monthName: this.data.monthName,
|
|
592
|
-
year: s.year,
|
|
593
|
-
today: t,
|
|
594
|
-
current: s,
|
|
595
|
-
blockPriorDates: this.blockPriorDates,
|
|
596
|
-
onDateClick: (r) => this.handleClick(r),
|
|
597
|
-
onMonthClick: () => this.state.view = "months",
|
|
598
|
-
onYearClick: () => this.state.view = "years",
|
|
599
|
-
next: () => {
|
|
600
|
-
const r = this.data.current, c = r.month === 11 ? { month: 0, year: r.year + 1 } : { month: r.month + 1, year: r.year };
|
|
601
|
-
this.setCurrent(c);
|
|
602
|
-
},
|
|
603
|
-
previous: () => {
|
|
604
|
-
const r = this.data.current, c = r.month === 0 ? { month: 11, year: r.year - 1 } : { month: r.month - 1, year: r.year };
|
|
605
|
-
this.setCurrent(c);
|
|
606
|
-
}
|
|
607
|
-
});
|
|
608
|
-
}
|
|
609
|
-
})
|
|
610
|
-
]);
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
const Ft = (e, t) => {
|
|
614
|
-
const s = e.toggleAllSelectedRows();
|
|
615
|
-
t.state.checked = !s;
|
|
616
|
-
}, Ht = (e) => J({ class: `cursor-pointer py-3 px-4 text-base w-10 ${e.class || ""}` }, [
|
|
617
|
-
nt((t) => new bt({ class: "mr-2", onChange: (s, a) => Ft(t, a) }))
|
|
618
|
-
]), Et = ({ align: e, sortable: t, key: s, label: a, sort: n, class: i }) => {
|
|
619
|
-
const l = e || "justify-start";
|
|
620
|
-
return J({
|
|
621
|
-
class: `cursor-pointer py-3 px-4 text-base ${i || ""}`,
|
|
622
|
-
click: t && (() => n(s))
|
|
299
|
+
const we = (t, e) => {
|
|
300
|
+
const s = t.toggleAllSelectedRows();
|
|
301
|
+
e.state.checked = !s;
|
|
302
|
+
}, be = (t) => O({ class: `cursor-pointer py-3 px-4 text-base w-10 ${t.class || ""}` }, [
|
|
303
|
+
F((e) => new ae({ class: "mr-2", onChange: (s, a) => we(e, a) }))
|
|
304
|
+
]), ye = ({ align: t, sortable: e, key: s, label: a, sort: i, class: n }) => {
|
|
305
|
+
const l = t || "justify-start";
|
|
306
|
+
return O({
|
|
307
|
+
class: `cursor-pointer py-3 px-4 text-base ${n || ""}`,
|
|
308
|
+
click: e && (() => i(s))
|
|
623
309
|
}, [
|
|
624
310
|
o({ class: `flex flex-auto w-full items-center ${l}` }, [
|
|
625
|
-
|
|
626
|
-
|
|
311
|
+
D(a),
|
|
312
|
+
e && E({ class: "ml-2", html: x.arrows.upDown })
|
|
627
313
|
])
|
|
628
314
|
]);
|
|
629
|
-
},
|
|
630
|
-
|
|
315
|
+
}, B = (t) => Q([
|
|
316
|
+
X({
|
|
631
317
|
class: "text-muted-foreground border-b",
|
|
632
318
|
map: [
|
|
633
|
-
|
|
634
|
-
(
|
|
635
|
-
align:
|
|
636
|
-
sortable:
|
|
637
|
-
key:
|
|
638
|
-
label:
|
|
639
|
-
sort:
|
|
319
|
+
t.headers,
|
|
320
|
+
(e) => e.label === "checkbox" ? be({ toggle: t.toggle }) : ye({
|
|
321
|
+
align: e.align,
|
|
322
|
+
sortable: e.sortable,
|
|
323
|
+
key: e.key,
|
|
324
|
+
label: e.label,
|
|
325
|
+
sort: t.sort
|
|
640
326
|
})
|
|
641
327
|
]
|
|
642
328
|
})
|
|
643
|
-
]),
|
|
329
|
+
]), xe = ({ key: t, rows: e, selectRow: s, rowItem: a, emptyState: i }) => new J({
|
|
644
330
|
cache: "list",
|
|
645
|
-
key:
|
|
646
|
-
items:
|
|
647
|
-
rowItem: (
|
|
331
|
+
key: t,
|
|
332
|
+
items: e,
|
|
333
|
+
rowItem: (n) => a(n, s),
|
|
648
334
|
class: "divide-y divide-border",
|
|
649
|
-
emptyState:
|
|
335
|
+
emptyState: i
|
|
650
336
|
});
|
|
651
|
-
class
|
|
337
|
+
class j extends h {
|
|
652
338
|
/**
|
|
653
339
|
* Initializes component data.
|
|
654
340
|
*
|
|
655
341
|
* @returns {Data}
|
|
656
342
|
*/
|
|
657
343
|
setData() {
|
|
658
|
-
let
|
|
659
|
-
return (this.loadMoreItems || this.tableData) && !
|
|
344
|
+
let e = this.rows && this.rows.length > 0;
|
|
345
|
+
return (this.loadMoreItems || this.tableData) && !e && (e = null), new C({
|
|
660
346
|
selectedRows: [],
|
|
661
347
|
// @ts-ignore
|
|
662
|
-
hasItems:
|
|
348
|
+
hasItems: e,
|
|
663
349
|
selected: !1
|
|
664
350
|
});
|
|
665
351
|
}
|
|
@@ -669,7 +355,7 @@ class tt extends m {
|
|
|
669
355
|
* @returns {boolean}
|
|
670
356
|
*/
|
|
671
357
|
toggleAllSelectedRows() {
|
|
672
|
-
const
|
|
358
|
+
const e = this.list.getRows(), s = this.data.selectedRows.length === e.length, a = s ? [] : e;
|
|
673
359
|
return this.data.selectedRows = a, this.updateSelected(), this.updateTable(!s), s;
|
|
674
360
|
}
|
|
675
361
|
/**
|
|
@@ -678,8 +364,8 @@ class tt extends m {
|
|
|
678
364
|
* @returns {void}
|
|
679
365
|
*/
|
|
680
366
|
updateSelected() {
|
|
681
|
-
const
|
|
682
|
-
this.data.selected =
|
|
367
|
+
const e = this.data.get("selectedRows");
|
|
368
|
+
this.data.selected = e.length > 0;
|
|
683
369
|
}
|
|
684
370
|
/**
|
|
685
371
|
* This will get the selected rows.
|
|
@@ -696,20 +382,20 @@ class tt extends m {
|
|
|
696
382
|
* @param {boolean} selected
|
|
697
383
|
* @returns {void}
|
|
698
384
|
*/
|
|
699
|
-
updateTable(
|
|
385
|
+
updateTable(e) {
|
|
700
386
|
const s = this.list.getRows();
|
|
701
|
-
s.forEach((a) => a.selected =
|
|
387
|
+
s.forEach((a) => a.selected = e), this.list.setRows(s);
|
|
702
388
|
}
|
|
703
389
|
/**
|
|
704
390
|
* Handles row selection.
|
|
705
391
|
*
|
|
706
392
|
* @param {object} row
|
|
707
393
|
*/
|
|
708
|
-
selectRow(
|
|
709
|
-
const s =
|
|
710
|
-
|
|
711
|
-
const a = this.data.get("selectedRows"),
|
|
712
|
-
this.data.selectedRows =
|
|
394
|
+
selectRow(e) {
|
|
395
|
+
const s = e.selected ?? !1;
|
|
396
|
+
e.selected = !s;
|
|
397
|
+
const a = this.data.get("selectedRows"), i = e.selected ? [...a, e] : a.filter((n) => n !== e);
|
|
398
|
+
this.data.selectedRows = i, this.updateSelected();
|
|
713
399
|
}
|
|
714
400
|
/**
|
|
715
401
|
* Renders the DataTable component.
|
|
@@ -717,19 +403,19 @@ class tt extends m {
|
|
|
717
403
|
* @returns {object}
|
|
718
404
|
*/
|
|
719
405
|
render() {
|
|
720
|
-
const
|
|
406
|
+
const e = this.rows, s = this.border !== !1 ? "border" : "";
|
|
721
407
|
return o({ class: "w-full flex flex-auto flex-col" }, [
|
|
722
|
-
|
|
408
|
+
v("hasItems", (a) => a === !1 && this.emptyState ? this.emptyState() : null),
|
|
723
409
|
o({ class: `w-full rounded-md ${s} overflow-x-auto`, onSet: ["hasItems", { hidden: !1 }] }, [
|
|
724
|
-
|
|
410
|
+
L({ class: "w-full" }, [
|
|
725
411
|
// @ts-ignore
|
|
726
|
-
this.headers &&
|
|
412
|
+
this.headers && B({ headers: this.headers, sort: (a) => this.sortRows(a) }),
|
|
727
413
|
// @ts-ignore
|
|
728
414
|
this.customHeader ?? null,
|
|
729
|
-
|
|
415
|
+
xe({
|
|
730
416
|
// @ts-ignore
|
|
731
417
|
key: this.key,
|
|
732
|
-
rows:
|
|
418
|
+
rows: e,
|
|
733
419
|
// @ts-ignore
|
|
734
420
|
selectRow: this.selectRow.bind(this),
|
|
735
421
|
// @ts-ignore
|
|
@@ -748,8 +434,8 @@ class tt extends m {
|
|
|
748
434
|
* @param {array} items
|
|
749
435
|
* @returns {void}
|
|
750
436
|
*/
|
|
751
|
-
remove(
|
|
752
|
-
this.list.remove(
|
|
437
|
+
remove(e) {
|
|
438
|
+
this.list.remove(e);
|
|
753
439
|
}
|
|
754
440
|
/**
|
|
755
441
|
* This will set the items in the list.
|
|
@@ -758,8 +444,8 @@ class tt extends m {
|
|
|
758
444
|
* @param {array} rows
|
|
759
445
|
* @returns {void}
|
|
760
446
|
*/
|
|
761
|
-
setRows(
|
|
762
|
-
this.list.setRows(
|
|
447
|
+
setRows(e) {
|
|
448
|
+
this.list.setRows(e);
|
|
763
449
|
}
|
|
764
450
|
/**
|
|
765
451
|
* This will append items to the list.
|
|
@@ -768,8 +454,8 @@ class tt extends m {
|
|
|
768
454
|
* @param {array|object} items
|
|
769
455
|
* @returns {void}
|
|
770
456
|
*/
|
|
771
|
-
append(
|
|
772
|
-
this.list.append(
|
|
457
|
+
append(e) {
|
|
458
|
+
this.list.append(e);
|
|
773
459
|
}
|
|
774
460
|
/**
|
|
775
461
|
* This will mingle the new items with the old items.
|
|
@@ -779,8 +465,8 @@ class tt extends m {
|
|
|
779
465
|
* @param {boolean} withDelete
|
|
780
466
|
* @returns {void}
|
|
781
467
|
*/
|
|
782
|
-
mingle(
|
|
783
|
-
this.list.mingle(
|
|
468
|
+
mingle(e, s = !1) {
|
|
469
|
+
this.list.mingle(e, s);
|
|
784
470
|
}
|
|
785
471
|
/**
|
|
786
472
|
* This will prepend items to the list.
|
|
@@ -789,8 +475,8 @@ class tt extends m {
|
|
|
789
475
|
* @param {array|object} items
|
|
790
476
|
* @returns {void}
|
|
791
477
|
*/
|
|
792
|
-
prepend(
|
|
793
|
-
this.list.prepend(
|
|
478
|
+
prepend(e) {
|
|
479
|
+
this.list.prepend(e);
|
|
794
480
|
}
|
|
795
481
|
/**
|
|
796
482
|
* This will remove the selected rows.
|
|
@@ -801,34 +487,34 @@ class tt extends m {
|
|
|
801
487
|
this.data.selectedRows = [];
|
|
802
488
|
}
|
|
803
489
|
}
|
|
804
|
-
const
|
|
490
|
+
const ke = (t) => new Z({
|
|
805
491
|
cache: "list",
|
|
806
|
-
loadMoreItems:
|
|
807
|
-
offset:
|
|
808
|
-
limit:
|
|
809
|
-
key:
|
|
810
|
-
tableData:
|
|
811
|
-
items:
|
|
812
|
-
rowItem: (
|
|
492
|
+
loadMoreItems: t.loadMoreItems,
|
|
493
|
+
offset: t.offset,
|
|
494
|
+
limit: t.limit,
|
|
495
|
+
key: t.key,
|
|
496
|
+
tableData: t.tableData,
|
|
497
|
+
items: t.items,
|
|
498
|
+
rowItem: (e) => t.rowItem(e, t.selectRow),
|
|
813
499
|
class: "divide-y divide-border"
|
|
814
500
|
});
|
|
815
|
-
class
|
|
501
|
+
class ve extends j {
|
|
816
502
|
/**
|
|
817
503
|
* Renders the DataTable component.
|
|
818
504
|
*
|
|
819
505
|
* @returns {object}
|
|
820
506
|
*/
|
|
821
507
|
render() {
|
|
822
|
-
const
|
|
508
|
+
const e = this.rows, s = this.border !== !1 ? "border" : "";
|
|
823
509
|
return o({ class: "w-full flex flex-auto flex-col" }, [
|
|
824
|
-
|
|
510
|
+
v("hasItems", (a) => a === !1 && this.emptyState ? this.emptyState() : null),
|
|
825
511
|
o({ class: `w-full rounded-md ${s} overflow-x-auto`, onSet: ["hasItems", { hidden: !1 }] }, [
|
|
826
|
-
|
|
512
|
+
L({ class: "w-full" }, [
|
|
827
513
|
// @ts-ignore
|
|
828
|
-
this.headers &&
|
|
514
|
+
this.headers && B({ headers: this.headers, sort: (a) => this.sortRows(a) }),
|
|
829
515
|
// @ts-ignore
|
|
830
516
|
this.customHeader ?? null,
|
|
831
|
-
|
|
517
|
+
ke({
|
|
832
518
|
// @ts-ignore
|
|
833
519
|
loadMoreItems: this.loadMoreItems,
|
|
834
520
|
// @ts-ignore
|
|
@@ -841,7 +527,7 @@ class Xt extends tt {
|
|
|
841
527
|
tableData: this.tableData,
|
|
842
528
|
// @ts-ignore
|
|
843
529
|
key: this.key,
|
|
844
|
-
items:
|
|
530
|
+
items: e,
|
|
845
531
|
// @ts-ignore
|
|
846
532
|
selectRow: this.selectRow.bind(this),
|
|
847
533
|
// @ts-ignore
|
|
@@ -860,51 +546,51 @@ class Xt extends tt {
|
|
|
860
546
|
this.list.refresh();
|
|
861
547
|
}
|
|
862
548
|
}
|
|
863
|
-
const
|
|
549
|
+
const lt = d((t) => new ve(
|
|
864
550
|
{
|
|
865
|
-
cache:
|
|
866
|
-
tableData:
|
|
867
|
-
loadMoreItems:
|
|
868
|
-
offset:
|
|
869
|
-
limit:
|
|
870
|
-
class:
|
|
871
|
-
key:
|
|
872
|
-
rows:
|
|
873
|
-
rowItem:
|
|
874
|
-
headers:
|
|
875
|
-
customHeader:
|
|
876
|
-
border:
|
|
877
|
-
emptyState:
|
|
878
|
-
}
|
|
879
|
-
)),
|
|
551
|
+
cache: t.cache ?? "list",
|
|
552
|
+
tableData: t.data,
|
|
553
|
+
loadMoreItems: t.loadMoreItems,
|
|
554
|
+
offset: t.offset,
|
|
555
|
+
limit: t.limit,
|
|
556
|
+
class: t.class,
|
|
557
|
+
key: t.key,
|
|
558
|
+
rows: t.rows,
|
|
559
|
+
rowItem: t.rowItem,
|
|
560
|
+
headers: t.headers,
|
|
561
|
+
customHeader: t.customHeader,
|
|
562
|
+
border: t.border,
|
|
563
|
+
emptyState: t.emptyState
|
|
564
|
+
}
|
|
565
|
+
)), De = (t) => new ee({
|
|
880
566
|
cache: "list",
|
|
881
|
-
scrollContainer:
|
|
882
|
-
loadMoreItems:
|
|
883
|
-
offset:
|
|
884
|
-
limit:
|
|
885
|
-
key:
|
|
886
|
-
tableData:
|
|
887
|
-
items:
|
|
888
|
-
rowItem: (
|
|
567
|
+
scrollContainer: t.scrollContainer,
|
|
568
|
+
loadMoreItems: t.loadMoreItems,
|
|
569
|
+
offset: t.offset,
|
|
570
|
+
limit: t.limit,
|
|
571
|
+
key: t.key,
|
|
572
|
+
tableData: t.tableData,
|
|
573
|
+
items: t.items,
|
|
574
|
+
rowItem: (e) => t.rowItem(e, t.selectRow),
|
|
889
575
|
class: "divide-y divide-border"
|
|
890
576
|
});
|
|
891
|
-
class
|
|
577
|
+
class Se extends j {
|
|
892
578
|
/**
|
|
893
579
|
* Renders the DataTable component.
|
|
894
580
|
*
|
|
895
581
|
* @returns {object}
|
|
896
582
|
*/
|
|
897
583
|
render() {
|
|
898
|
-
const
|
|
584
|
+
const e = this.rows, s = this.border !== !1 ? "border" : "";
|
|
899
585
|
return o({ class: "w-full flex flex-auto flex-col" }, [
|
|
900
|
-
|
|
586
|
+
v("hasItems", (a) => a === !1 && this.emptyState ? this.emptyState() : null),
|
|
901
587
|
o({ class: `w-full rounded-md ${s} overflow-x-auto`, onSet: ["hasItems", { hidden: !1 }] }, [
|
|
902
|
-
|
|
588
|
+
L({ class: "w-full" }, [
|
|
903
589
|
// @ts-ignore
|
|
904
|
-
this.headers &&
|
|
590
|
+
this.headers && B({ headers: this.headers, sort: (a) => this.sortRows(a) }),
|
|
905
591
|
// @ts-ignore
|
|
906
592
|
this.customHeader ?? null,
|
|
907
|
-
|
|
593
|
+
De({
|
|
908
594
|
// @ts-ignore
|
|
909
595
|
scrollContainer: this.scrollContainer,
|
|
910
596
|
// @ts-ignore
|
|
@@ -919,7 +605,7 @@ class Kt extends tt {
|
|
|
919
605
|
tableData: this.tableData,
|
|
920
606
|
// @ts-ignore
|
|
921
607
|
key: this.key,
|
|
922
|
-
items:
|
|
608
|
+
items: e,
|
|
923
609
|
// @ts-ignore
|
|
924
610
|
selectRow: this.selectRow.bind(this),
|
|
925
611
|
// @ts-ignore
|
|
@@ -938,62 +624,62 @@ class Kt extends tt {
|
|
|
938
624
|
this.list.refresh();
|
|
939
625
|
}
|
|
940
626
|
}
|
|
941
|
-
const
|
|
627
|
+
const rt = d((t) => new Se(
|
|
942
628
|
{
|
|
943
|
-
cache:
|
|
944
|
-
tableData:
|
|
945
|
-
scrollContainer:
|
|
946
|
-
loadMoreItems:
|
|
947
|
-
offset:
|
|
948
|
-
limit:
|
|
949
|
-
class:
|
|
950
|
-
key:
|
|
951
|
-
rows:
|
|
952
|
-
rowItem:
|
|
953
|
-
headers:
|
|
954
|
-
customHeader:
|
|
955
|
-
border:
|
|
956
|
-
emptyState:
|
|
957
|
-
}
|
|
958
|
-
)),
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
])),
|
|
629
|
+
cache: t.cache ?? "list",
|
|
630
|
+
tableData: t.data,
|
|
631
|
+
scrollContainer: t.scrollContainer,
|
|
632
|
+
loadMoreItems: t.loadMoreItems,
|
|
633
|
+
offset: t.offset,
|
|
634
|
+
limit: t.limit,
|
|
635
|
+
class: t.class,
|
|
636
|
+
key: t.key,
|
|
637
|
+
rows: t.rows,
|
|
638
|
+
rowItem: t.rowItem,
|
|
639
|
+
headers: t.headers,
|
|
640
|
+
customHeader: t.customHeader,
|
|
641
|
+
border: t.border,
|
|
642
|
+
emptyState: t.emptyState
|
|
643
|
+
}
|
|
644
|
+
)), Ie = d(({ name: t, email: e }) => o({ class: "min-w-0 flex-auto" }, [
|
|
645
|
+
p({ class: "text-base font-semibold leading-6 m-0" }, t),
|
|
646
|
+
p({ class: "truncate text-sm leading-5 text-muted-foreground m-0" }, e)
|
|
647
|
+
])), Le = () => o({ class: "flex items-center gap-x-1.5" }, [
|
|
962
648
|
o({ class: "flex-none rounded-full bg-emerald-500/20 p-1" }, [
|
|
963
649
|
o({ class: "h-1.5 w-1.5 rounded-full bg-emerald-500" })
|
|
964
650
|
]),
|
|
965
|
-
|
|
966
|
-
]),
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
]),
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
])),
|
|
651
|
+
p({ class: "text-xs leading-5 text-gray-500" }, "Online")
|
|
652
|
+
]), Ce = (t) => p({ class: "text-xs leading-5 text-muted-foreground" }, [
|
|
653
|
+
D("Last seen "),
|
|
654
|
+
q({ datetime: t }, "3h ago")
|
|
655
|
+
]), Te = (t, e) => t === "online" ? Le() : Ce(e), Be = d(({ role: t, lastSeen: e, status: s }) => o({ class: "hidden shrink-0 sm:flex sm:flex-col sm:items-end" }, [
|
|
656
|
+
p({ class: "text-sm leading-6 m-0" }, t),
|
|
657
|
+
Te(s, e)
|
|
658
|
+
])), Me = (t) => t.split(" ").map((s) => s[0]).join(""), Re = d((t) => S({ class: "fadeIn flex justify-between gap-x-6 py-4 px-4 rounded-md hover:bg-muted/50" }, [
|
|
973
659
|
o({ class: "flex min-w-0 gap-x-4" }, [
|
|
974
|
-
|
|
975
|
-
|
|
660
|
+
oe({ src: t.image, alt: t.name, fallbackText: Me(t.name) }),
|
|
661
|
+
Ie({ name: t.name, email: t.email })
|
|
976
662
|
]),
|
|
977
|
-
|
|
978
|
-
role:
|
|
979
|
-
lastSeen:
|
|
980
|
-
status:
|
|
663
|
+
Be({
|
|
664
|
+
role: t.role,
|
|
665
|
+
lastSeen: t.lastSeen,
|
|
666
|
+
status: t.status
|
|
981
667
|
})
|
|
982
|
-
])),
|
|
668
|
+
])), ct = d((t) => new te({
|
|
983
669
|
cache: "list",
|
|
984
670
|
key: "name",
|
|
985
|
-
items:
|
|
671
|
+
items: t.users,
|
|
986
672
|
role: "list",
|
|
987
673
|
class: "divide-y divide-border",
|
|
988
|
-
rowItem:
|
|
989
|
-
})),
|
|
990
|
-
text:
|
|
991
|
-
href:
|
|
674
|
+
rowItem: Re
|
|
675
|
+
})), We = (t, e) => e.includes(t), Pe = (t, e, s) => t.exact ? s === e : We(e, s), Oe = ({ text: t, href: e, exact: s, hidden: a }) => new $({
|
|
676
|
+
text: t,
|
|
677
|
+
href: e,
|
|
992
678
|
exact: s,
|
|
993
679
|
dataSet: ["selected", ["state", !0, "active"]],
|
|
994
680
|
class: `${a ? "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`
|
|
995
681
|
});
|
|
996
|
-
class
|
|
682
|
+
class dt extends h {
|
|
997
683
|
/**
|
|
998
684
|
* This will declare the props for the compiler.
|
|
999
685
|
*
|
|
@@ -1014,14 +700,14 @@ class We extends m {
|
|
|
1014
700
|
* @returns {object}
|
|
1015
701
|
*/
|
|
1016
702
|
render() {
|
|
1017
|
-
return
|
|
703
|
+
return I(
|
|
1018
704
|
{ class: `flex items-center justify-center p-2 text-muted-foreground rounded-md ${this.class || ""}` },
|
|
1019
705
|
[
|
|
1020
|
-
|
|
706
|
+
w({
|
|
1021
707
|
class: "flex space-x-4",
|
|
1022
|
-
map: [this.options, (
|
|
708
|
+
map: [this.options, (e) => this.addLink(e)],
|
|
1023
709
|
watch: {
|
|
1024
|
-
value: ["[[path]]",
|
|
710
|
+
value: ["[[path]]", y.data],
|
|
1025
711
|
callBack: this.updateLinks.bind(this)
|
|
1026
712
|
}
|
|
1027
713
|
})
|
|
@@ -1034,8 +720,8 @@ class We extends m {
|
|
|
1034
720
|
* @returns {void}
|
|
1035
721
|
*/
|
|
1036
722
|
afterSetup() {
|
|
1037
|
-
const
|
|
1038
|
-
this.updateLinks(
|
|
723
|
+
const e = y.data.path;
|
|
724
|
+
this.updateLinks(e);
|
|
1039
725
|
}
|
|
1040
726
|
/**
|
|
1041
727
|
* This will update the links based on the current path.
|
|
@@ -1043,13 +729,13 @@ class We extends m {
|
|
|
1043
729
|
* @param {string} path
|
|
1044
730
|
* @returns {void}
|
|
1045
731
|
*/
|
|
1046
|
-
updateLinks(
|
|
732
|
+
updateLinks(e) {
|
|
1047
733
|
let s = !1;
|
|
1048
734
|
this.deactivateAllLinks();
|
|
1049
735
|
for (const a of this.links) {
|
|
1050
736
|
if (!a.rendered)
|
|
1051
737
|
continue;
|
|
1052
|
-
|
|
738
|
+
Pe(a, a.getLinkPath(), e) ? (this.updateLink(a, !0), s = !0) : this.updateLink(a, !1);
|
|
1053
739
|
}
|
|
1054
740
|
!s && this.links[0] && this.updateLink(this.links[0], !0);
|
|
1055
741
|
}
|
|
@@ -1059,8 +745,8 @@ class We extends m {
|
|
|
1059
745
|
* @returns {void}
|
|
1060
746
|
*/
|
|
1061
747
|
deactivateAllLinks() {
|
|
1062
|
-
for (const
|
|
1063
|
-
this.updateLink(
|
|
748
|
+
for (const e of this.links)
|
|
749
|
+
this.updateLink(e, !1);
|
|
1064
750
|
}
|
|
1065
751
|
/**
|
|
1066
752
|
* This will update the link's active state.
|
|
@@ -1069,8 +755,8 @@ class We extends m {
|
|
|
1069
755
|
* @param {boolean} selected
|
|
1070
756
|
* @returns {void}
|
|
1071
757
|
*/
|
|
1072
|
-
updateLink(
|
|
1073
|
-
|
|
758
|
+
updateLink(e, s) {
|
|
759
|
+
e.update(s);
|
|
1074
760
|
}
|
|
1075
761
|
/**
|
|
1076
762
|
* This will add a link to the navigation.
|
|
@@ -1078,9 +764,9 @@ class We extends m {
|
|
|
1078
764
|
* @param {object} option
|
|
1079
765
|
* @returns {object}
|
|
1080
766
|
*/
|
|
1081
|
-
addLink({ label:
|
|
1082
|
-
const
|
|
1083
|
-
return this.links.push(
|
|
767
|
+
addLink({ label: e, href: s, exact: a, hidden: i }) {
|
|
768
|
+
const n = Oe({ text: e, href: s, exact: a, hidden: i });
|
|
769
|
+
return this.links.push(n), n;
|
|
1084
770
|
}
|
|
1085
771
|
/**
|
|
1086
772
|
* This will clear the links.
|
|
@@ -1091,13 +777,13 @@ class We extends m {
|
|
|
1091
777
|
this.links = [];
|
|
1092
778
|
}
|
|
1093
779
|
}
|
|
1094
|
-
const
|
|
1095
|
-
const
|
|
1096
|
-
return
|
|
1097
|
-
|
|
780
|
+
const ht = d((t) => {
|
|
781
|
+
const e = t.margin || "m-4 ml-0";
|
|
782
|
+
return t.allowHistory = t.allowHistory === !0, o({ class: `flex-none ${e}` }, [
|
|
783
|
+
T({ variant: "back", class: "ghost", ...t })
|
|
1098
784
|
]);
|
|
1099
785
|
});
|
|
1100
|
-
class
|
|
786
|
+
class A extends h {
|
|
1101
787
|
/**
|
|
1102
788
|
* This will declare the props for the compiler.
|
|
1103
789
|
*
|
|
@@ -1138,7 +824,7 @@ class et extends m {
|
|
|
1138
824
|
* @param {object} container
|
|
1139
825
|
* @returns {void}
|
|
1140
826
|
*/
|
|
1141
|
-
setContainer(
|
|
827
|
+
setContainer(e) {
|
|
1142
828
|
this.container = app.root;
|
|
1143
829
|
}
|
|
1144
830
|
/**
|
|
@@ -1184,13 +870,13 @@ class et extends m {
|
|
|
1184
870
|
return this.children;
|
|
1185
871
|
}
|
|
1186
872
|
}
|
|
1187
|
-
|
|
1188
|
-
if (!
|
|
873
|
+
N.addType("dockableOverlay", (t) => {
|
|
874
|
+
if (!t)
|
|
1189
875
|
return;
|
|
1190
|
-
const
|
|
1191
|
-
|
|
876
|
+
const e = t.component;
|
|
877
|
+
e && e.rendered === !0 && e.state.docked === !1 && e.destroy();
|
|
1192
878
|
});
|
|
1193
|
-
class
|
|
879
|
+
class ut extends A {
|
|
1194
880
|
/**
|
|
1195
881
|
* This will stop presistence.
|
|
1196
882
|
*
|
|
@@ -1205,7 +891,7 @@ class je extends et {
|
|
|
1205
891
|
* @returns {object}
|
|
1206
892
|
*/
|
|
1207
893
|
render() {
|
|
1208
|
-
const
|
|
894
|
+
const e = this.container;
|
|
1209
895
|
return o(
|
|
1210
896
|
{
|
|
1211
897
|
onState: [
|
|
@@ -1213,7 +899,7 @@ class je extends et {
|
|
|
1213
899
|
loading: !0
|
|
1214
900
|
}],
|
|
1215
901
|
["docked", (s, a) => {
|
|
1216
|
-
s ? (a.className = this.getDockedClassName(),
|
|
902
|
+
s ? (a.className = this.getDockedClassName(), e.appendChild(a), document.documentElement.style.overflowY = "auto") : (a.className = this.getClassName(), app.root.appendChild(a), document.documentElement.style.overflowY = "hidden");
|
|
1217
903
|
}]
|
|
1218
904
|
]
|
|
1219
905
|
},
|
|
@@ -1236,8 +922,8 @@ class je extends et {
|
|
|
1236
922
|
* @param {object} container
|
|
1237
923
|
* @returns {void}
|
|
1238
924
|
*/
|
|
1239
|
-
setup(
|
|
1240
|
-
this.container =
|
|
925
|
+
setup(e) {
|
|
926
|
+
this.container = e, this.initialize();
|
|
1241
927
|
}
|
|
1242
928
|
/**
|
|
1243
929
|
* This will setup the overlay states.
|
|
@@ -1256,7 +942,7 @@ class je extends et {
|
|
|
1256
942
|
* @returns {void}
|
|
1257
943
|
*/
|
|
1258
944
|
afterSetup() {
|
|
1259
|
-
|
|
945
|
+
N.add(
|
|
1260
946
|
this.container,
|
|
1261
947
|
"dockableOverlay",
|
|
1262
948
|
{
|
|
@@ -1299,7 +985,7 @@ class je extends et {
|
|
|
1299
985
|
document.documentElement.style.overflowY = "auto";
|
|
1300
986
|
}
|
|
1301
987
|
}
|
|
1302
|
-
class
|
|
988
|
+
class ft extends A {
|
|
1303
989
|
/**
|
|
1304
990
|
* This will get the overlay type.
|
|
1305
991
|
*
|
|
@@ -1314,55 +1000,55 @@ class ze extends et {
|
|
|
1314
1000
|
* @param {object} container
|
|
1315
1001
|
* @returns {void}
|
|
1316
1002
|
*/
|
|
1317
|
-
setup(
|
|
1318
|
-
this.container =
|
|
1003
|
+
setup(e) {
|
|
1004
|
+
this.container = e, this.initialize();
|
|
1319
1005
|
}
|
|
1320
1006
|
}
|
|
1321
|
-
const
|
|
1007
|
+
const ze = d(({ index: t, click: e, state: s }, a) => S({
|
|
1322
1008
|
class: "p-2 cursor-pointer hover:bg-muted/50",
|
|
1323
1009
|
onState: [
|
|
1324
1010
|
[s, "selectedIndex", {
|
|
1325
|
-
"bg-accent":
|
|
1326
|
-
"text-white":
|
|
1011
|
+
"bg-accent": t,
|
|
1012
|
+
"text-white": t
|
|
1327
1013
|
}]
|
|
1328
1014
|
],
|
|
1329
|
-
click: () => t
|
|
1330
|
-
}, a)),
|
|
1015
|
+
click: () => e(t)
|
|
1016
|
+
}, a)), $e = d(({ selectOption: t, state: e }) => w({
|
|
1331
1017
|
class: "border rounded-md list-none m-0 p-0 max-h-[400px] overflow-y-auto",
|
|
1332
|
-
for: ["filteredOptions", (s, a) =>
|
|
1333
|
-
})),
|
|
1334
|
-
|
|
1018
|
+
for: ["filteredOptions", (s, a) => ze({ index: a, click: t, state: e }, s.label)]
|
|
1019
|
+
})), Ne = d((t) => o({ class: "relative flex items-center" }, [
|
|
1020
|
+
ie({
|
|
1335
1021
|
cache: "input",
|
|
1336
|
-
class:
|
|
1337
|
-
placeholder:
|
|
1338
|
-
bind:
|
|
1339
|
-
keyup: (
|
|
1340
|
-
s.state && (s.state.open = !1), typeof
|
|
1022
|
+
class: t.class ?? "",
|
|
1023
|
+
placeholder: t.placeholder ?? "Search...",
|
|
1024
|
+
bind: t.bind ?? [t.state, "searchQuery"],
|
|
1025
|
+
keyup: (e, s) => {
|
|
1026
|
+
s.state && (s.state.open = !1), typeof t.filterOptions == "function" && t.filterOptions(), s.dropdown && s.dropdown.updatePosition(), t.keyup && t.keyup(e, s);
|
|
1341
1027
|
},
|
|
1342
|
-
pointerup: (
|
|
1028
|
+
pointerup: (e, s) => {
|
|
1343
1029
|
typeof s.toggleDropdown == "function" && s.toggleDropdown();
|
|
1344
1030
|
},
|
|
1345
|
-
keydown: (
|
|
1346
|
-
typeof
|
|
1031
|
+
keydown: (e) => [
|
|
1032
|
+
typeof t.handleKeyDown == "function" && t.handleKeyDown(e)
|
|
1347
1033
|
]
|
|
1348
1034
|
}),
|
|
1349
|
-
|
|
1350
|
-
|
|
1035
|
+
t.icon && o({ class: "absolute flex right-0 mr-2" }, [
|
|
1036
|
+
_(t.icon)
|
|
1351
1037
|
])
|
|
1352
|
-
])),
|
|
1038
|
+
])), je = (t) => o({
|
|
1353
1039
|
class: "relative flex fle-auto flex-col",
|
|
1354
|
-
onState: ["open", (
|
|
1355
|
-
if (
|
|
1356
|
-
return new
|
|
1040
|
+
onState: ["open", (e, s, a) => {
|
|
1041
|
+
if (e)
|
|
1042
|
+
return new le({
|
|
1357
1043
|
cache: "dropdown",
|
|
1358
1044
|
parent: a,
|
|
1359
1045
|
button: a.input,
|
|
1360
1046
|
size: "xl"
|
|
1361
1047
|
}, [
|
|
1362
|
-
|
|
1048
|
+
$e(t)
|
|
1363
1049
|
]);
|
|
1364
1050
|
}]
|
|
1365
|
-
}),
|
|
1051
|
+
}), gt = V(
|
|
1366
1052
|
{
|
|
1367
1053
|
/**
|
|
1368
1054
|
* This will set up the data object.
|
|
@@ -1370,10 +1056,10 @@ const ie = g(({ index: e, click: t, state: s }, a) => W({
|
|
|
1370
1056
|
* @returns {object} - The data object.
|
|
1371
1057
|
*/
|
|
1372
1058
|
setData() {
|
|
1373
|
-
const
|
|
1374
|
-
return new
|
|
1375
|
-
options:
|
|
1376
|
-
filteredOptions:
|
|
1059
|
+
const t = this.options || [];
|
|
1060
|
+
return new C({
|
|
1061
|
+
options: t,
|
|
1062
|
+
filteredOptions: t
|
|
1377
1063
|
});
|
|
1378
1064
|
},
|
|
1379
1065
|
/**
|
|
@@ -1394,10 +1080,10 @@ const ie = g(({ index: e, click: t, state: s }, a) => W({
|
|
|
1394
1080
|
* @returns {void}
|
|
1395
1081
|
*/
|
|
1396
1082
|
setSelectedIndexByQuery() {
|
|
1397
|
-
const
|
|
1398
|
-
let { searchQuery:
|
|
1399
|
-
|
|
1400
|
-
const s =
|
|
1083
|
+
const t = this.data.filteredOptions;
|
|
1084
|
+
let { searchQuery: e } = this.state;
|
|
1085
|
+
e = e.toLowerCase();
|
|
1086
|
+
const s = t.findIndex((a) => a.label.toLowerCase() === e);
|
|
1401
1087
|
s >= 0 && (this.state.selectedIndex = s);
|
|
1402
1088
|
},
|
|
1403
1089
|
/**
|
|
@@ -1406,14 +1092,14 @@ const ie = g(({ index: e, click: t, state: s }, a) => W({
|
|
|
1406
1092
|
* @returns {void}
|
|
1407
1093
|
*/
|
|
1408
1094
|
filterOptions() {
|
|
1409
|
-
const
|
|
1410
|
-
if (
|
|
1095
|
+
const t = this.state.searchQuery.toLowerCase();
|
|
1096
|
+
if (t === "" || t.length === 0) {
|
|
1411
1097
|
this.data.filteredOptions = this.data.options;
|
|
1412
1098
|
return;
|
|
1413
1099
|
}
|
|
1414
|
-
const
|
|
1415
|
-
this.data.filteredOptions =
|
|
1416
|
-
(s) => s.label.toLowerCase().includes(
|
|
1100
|
+
const e = this.data.get("options");
|
|
1101
|
+
this.data.filteredOptions = e.filter(
|
|
1102
|
+
(s) => s.label.toLowerCase().includes(t)
|
|
1417
1103
|
);
|
|
1418
1104
|
},
|
|
1419
1105
|
/**
|
|
@@ -1422,8 +1108,8 @@ const ie = g(({ index: e, click: t, state: s }, a) => W({
|
|
|
1422
1108
|
* @returns {object}
|
|
1423
1109
|
*/
|
|
1424
1110
|
getValue() {
|
|
1425
|
-
const { selectedIndex:
|
|
1426
|
-
return
|
|
1111
|
+
const { selectedIndex: t } = this.state;
|
|
1112
|
+
return t < 0 ? null : this.data.get(`filteredOptions[${t}]`);
|
|
1427
1113
|
},
|
|
1428
1114
|
/**
|
|
1429
1115
|
* This will select an option.
|
|
@@ -1431,10 +1117,10 @@ const ie = g(({ index: e, click: t, state: s }, a) => W({
|
|
|
1431
1117
|
* @param {number} index - The index of the option.
|
|
1432
1118
|
* @returns {void}
|
|
1433
1119
|
*/
|
|
1434
|
-
selectOption(
|
|
1435
|
-
this.state.selectedIndex =
|
|
1436
|
-
const
|
|
1437
|
-
this.state.searchQuery =
|
|
1120
|
+
selectOption(t) {
|
|
1121
|
+
this.state.selectedIndex = t;
|
|
1122
|
+
const e = this.data.get(`filteredOptions[${t}]`);
|
|
1123
|
+
this.state.searchQuery = e.label, this.state.open = !1, typeof this.onSelect == "function" && this.onSelect(e);
|
|
1438
1124
|
},
|
|
1439
1125
|
/**
|
|
1440
1126
|
* Toggles the dropdown open state.
|
|
@@ -1448,9 +1134,9 @@ const ie = g(({ index: e, click: t, state: s }, a) => W({
|
|
|
1448
1134
|
* @param {object} event - The event object.
|
|
1449
1135
|
* @returns {void}
|
|
1450
1136
|
*/
|
|
1451
|
-
handleKeyDown(
|
|
1452
|
-
const
|
|
1453
|
-
|
|
1137
|
+
handleKeyDown(t) {
|
|
1138
|
+
const e = this.data.filteredOptions, { selectedIndex: s } = this.state;
|
|
1139
|
+
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));
|
|
1454
1140
|
},
|
|
1455
1141
|
/**
|
|
1456
1142
|
* This will render the component.
|
|
@@ -1459,7 +1145,7 @@ const ie = g(({ index: e, click: t, state: s }, a) => W({
|
|
|
1459
1145
|
*/
|
|
1460
1146
|
render() {
|
|
1461
1147
|
return o({ class: "relative w-full max-w-md" }, [
|
|
1462
|
-
|
|
1148
|
+
Ne({
|
|
1463
1149
|
// @ts-ignore
|
|
1464
1150
|
state: this.state,
|
|
1465
1151
|
// @ts-ignore
|
|
@@ -1471,7 +1157,7 @@ const ie = g(({ index: e, click: t, state: s }, a) => W({
|
|
|
1471
1157
|
// @ts-ignore
|
|
1472
1158
|
handleKeyDown: this.handleKeyDown.bind(this)
|
|
1473
1159
|
}),
|
|
1474
|
-
|
|
1160
|
+
je({
|
|
1475
1161
|
// @ts-ignore
|
|
1476
1162
|
state: this.state,
|
|
1477
1163
|
// @ts-ignore
|
|
@@ -1482,22 +1168,22 @@ const ie = g(({ index: e, click: t, state: s }, a) => W({
|
|
|
1482
1168
|
]);
|
|
1483
1169
|
}
|
|
1484
1170
|
}
|
|
1485
|
-
),
|
|
1171
|
+
), Ae = (t) => S(
|
|
1486
1172
|
{
|
|
1487
1173
|
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",
|
|
1488
|
-
dataSet: ["selected", ["state",
|
|
1174
|
+
dataSet: ["selected", ["state", t.value, "active"]]
|
|
1489
1175
|
},
|
|
1490
1176
|
[
|
|
1491
|
-
|
|
1177
|
+
k({
|
|
1492
1178
|
class: "flex flex-auto justify-center items-center px-3 py-1.5 rounded-md",
|
|
1493
|
-
onSet: ["selected", { selected:
|
|
1494
|
-
click: (
|
|
1495
|
-
},
|
|
1179
|
+
onSet: ["selected", { selected: t.value }],
|
|
1180
|
+
click: (e) => t.callBack(t.value)
|
|
1181
|
+
}, t.label)
|
|
1496
1182
|
]
|
|
1497
|
-
),
|
|
1498
|
-
|
|
1183
|
+
), Ue = (t, e) => (t.callBack = e, Ae(t)), Ye = (t) => I({ class: `tab items-center justify-center rounded-md bg-muted p-1 text-muted-foreground ${t.class}` }, [
|
|
1184
|
+
w({ class: "flex flex-auto flex-row", map: [t.options, (e) => Ue(e, t.callBack)] })
|
|
1499
1185
|
]);
|
|
1500
|
-
class
|
|
1186
|
+
class mt extends h {
|
|
1501
1187
|
/**
|
|
1502
1188
|
* This will declare the props for the compiler.
|
|
1503
1189
|
*
|
|
@@ -1512,14 +1198,14 @@ class Ae extends m {
|
|
|
1512
1198
|
* @returns {object}
|
|
1513
1199
|
*/
|
|
1514
1200
|
render() {
|
|
1515
|
-
const
|
|
1201
|
+
const e = this.select.bind(this);
|
|
1516
1202
|
return o({ class: "" }, [
|
|
1517
|
-
|
|
1203
|
+
Ye({
|
|
1518
1204
|
class: this.class,
|
|
1519
1205
|
options: this.options,
|
|
1520
|
-
callBack:
|
|
1206
|
+
callBack: e
|
|
1521
1207
|
}),
|
|
1522
|
-
|
|
1208
|
+
z({
|
|
1523
1209
|
class: "tab-content",
|
|
1524
1210
|
onState: ["selected", this.updateContent.bind(this)]
|
|
1525
1211
|
})
|
|
@@ -1531,8 +1217,8 @@ class Ae extends m {
|
|
|
1531
1217
|
* @returns {*}
|
|
1532
1218
|
*/
|
|
1533
1219
|
getFirstValue() {
|
|
1534
|
-
var
|
|
1535
|
-
return (
|
|
1220
|
+
var e;
|
|
1221
|
+
return (e = this.options[0]) == null ? void 0 : e.value;
|
|
1536
1222
|
}
|
|
1537
1223
|
/**
|
|
1538
1224
|
* This will update the component.
|
|
@@ -1540,8 +1226,8 @@ class Ae extends m {
|
|
|
1540
1226
|
* @returns {void}
|
|
1541
1227
|
*/
|
|
1542
1228
|
update() {
|
|
1543
|
-
const
|
|
1544
|
-
this.select(null), this.select(
|
|
1229
|
+
const e = this.state.get("selected");
|
|
1230
|
+
this.select(null), this.select(e);
|
|
1545
1231
|
}
|
|
1546
1232
|
/**
|
|
1547
1233
|
* This will select a value.
|
|
@@ -1549,8 +1235,8 @@ class Ae extends m {
|
|
|
1549
1235
|
* @param {*} value
|
|
1550
1236
|
* @returns {void}
|
|
1551
1237
|
*/
|
|
1552
|
-
select(
|
|
1553
|
-
this.state.selected =
|
|
1238
|
+
select(e) {
|
|
1239
|
+
this.state.selected = e;
|
|
1554
1240
|
}
|
|
1555
1241
|
/**
|
|
1556
1242
|
* This will update the content.
|
|
@@ -1558,14 +1244,14 @@ class Ae extends m {
|
|
|
1558
1244
|
* @param {*} value
|
|
1559
1245
|
* @returns {object}
|
|
1560
1246
|
*/
|
|
1561
|
-
updateContent(
|
|
1247
|
+
updateContent(e) {
|
|
1562
1248
|
const s = this.options;
|
|
1563
1249
|
if (!s || s.length < 1)
|
|
1564
1250
|
return;
|
|
1565
1251
|
const a = s[0];
|
|
1566
|
-
for (const
|
|
1567
|
-
if (
|
|
1568
|
-
return
|
|
1252
|
+
for (const i of s)
|
|
1253
|
+
if (i.value === e)
|
|
1254
|
+
return i.layout;
|
|
1569
1255
|
return a.layout;
|
|
1570
1256
|
}
|
|
1571
1257
|
/**
|
|
@@ -1574,34 +1260,34 @@ class Ae extends m {
|
|
|
1574
1260
|
* @returns {object}
|
|
1575
1261
|
*/
|
|
1576
1262
|
setupStates() {
|
|
1577
|
-
const
|
|
1263
|
+
const e = this.callBack, s = typeof e;
|
|
1578
1264
|
return {
|
|
1579
1265
|
selected: {
|
|
1580
1266
|
state: this.getFirstValue(),
|
|
1581
1267
|
callBack(a) {
|
|
1582
|
-
s === "function" &&
|
|
1268
|
+
s === "function" && e(a);
|
|
1583
1269
|
}
|
|
1584
1270
|
}
|
|
1585
1271
|
};
|
|
1586
1272
|
}
|
|
1587
1273
|
}
|
|
1588
|
-
const
|
|
1274
|
+
const He = (t) => S(
|
|
1589
1275
|
{
|
|
1590
1276
|
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",
|
|
1591
|
-
dataSet: ["selected", ["state",
|
|
1277
|
+
dataSet: ["selected", ["state", t.value, "active"]]
|
|
1592
1278
|
},
|
|
1593
1279
|
[
|
|
1594
|
-
|
|
1280
|
+
k({
|
|
1595
1281
|
class: "flex flex-auto justify-center items-center px-3 py-1.5 rounded-md disabled:opacity-50 disabled:cursor-not-allowed",
|
|
1596
|
-
onSet: ["selected", { selected:
|
|
1597
|
-
click: (
|
|
1598
|
-
disabled:
|
|
1599
|
-
},
|
|
1282
|
+
onSet: ["selected", { selected: t.value }],
|
|
1283
|
+
click: (e) => t.callBack(t.value),
|
|
1284
|
+
disabled: t.disabled
|
|
1285
|
+
}, t.label)
|
|
1600
1286
|
]
|
|
1601
|
-
),
|
|
1602
|
-
|
|
1287
|
+
), Fe = (t, e) => (t.callBack = e, He(t)), Ee = (t) => I({ class: `tab items-center justify-center rounded-md bg-muted p-1 text-muted-foreground ${t.class}` }, [
|
|
1288
|
+
w({ class: "flex flex-auto flex-row", map: [t.options, (e) => Fe(e, t.callBack)] })
|
|
1603
1289
|
]);
|
|
1604
|
-
class
|
|
1290
|
+
class pt extends h {
|
|
1605
1291
|
/**
|
|
1606
1292
|
* This will declare the props for the compiler.
|
|
1607
1293
|
*
|
|
@@ -1616,11 +1302,11 @@ class Fe extends m {
|
|
|
1616
1302
|
* @returns {object}
|
|
1617
1303
|
*/
|
|
1618
1304
|
render() {
|
|
1619
|
-
const
|
|
1620
|
-
return
|
|
1305
|
+
const e = this.select.bind(this);
|
|
1306
|
+
return Ee({
|
|
1621
1307
|
class: this.class,
|
|
1622
1308
|
options: this.options,
|
|
1623
|
-
callBack:
|
|
1309
|
+
callBack: e
|
|
1624
1310
|
});
|
|
1625
1311
|
}
|
|
1626
1312
|
/**
|
|
@@ -1629,8 +1315,8 @@ class Fe extends m {
|
|
|
1629
1315
|
* @param {*} value
|
|
1630
1316
|
* @returns {void}
|
|
1631
1317
|
*/
|
|
1632
|
-
select(
|
|
1633
|
-
this.state.selected =
|
|
1318
|
+
select(e) {
|
|
1319
|
+
this.state.selected = e, typeof this.onSelect == "function" && this.onSelect(e, this.parent);
|
|
1634
1320
|
}
|
|
1635
1321
|
/**
|
|
1636
1322
|
* This will setup the states.
|
|
@@ -1638,23 +1324,23 @@ class Fe extends m {
|
|
|
1638
1324
|
* @returns {object}
|
|
1639
1325
|
*/
|
|
1640
1326
|
setupStates() {
|
|
1641
|
-
var
|
|
1327
|
+
var e;
|
|
1642
1328
|
return {
|
|
1643
|
-
selected: ((
|
|
1329
|
+
selected: ((e = this.options[0]) == null ? void 0 : e.value) || null
|
|
1644
1330
|
};
|
|
1645
1331
|
}
|
|
1646
1332
|
}
|
|
1647
|
-
const
|
|
1648
|
-
const s =
|
|
1649
|
-
return
|
|
1650
|
-
},
|
|
1651
|
-
text:
|
|
1652
|
-
href:
|
|
1333
|
+
const Qe = (t, e) => new RegExp(`${t}($|/|\\.).*`).test(e), Xe = (t, e) => {
|
|
1334
|
+
const s = t.getLinkPath();
|
|
1335
|
+
return t.exact ? e === s : Qe(s, e);
|
|
1336
|
+
}, qe = ({ text: t, href: e, exact: s }) => new $({
|
|
1337
|
+
text: t,
|
|
1338
|
+
href: e,
|
|
1653
1339
|
exact: s,
|
|
1654
1340
|
dataSet: ["selected", ["state", !0, "active"]],
|
|
1655
1341
|
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"
|
|
1656
1342
|
});
|
|
1657
|
-
class
|
|
1343
|
+
class Ke extends h {
|
|
1658
1344
|
/**
|
|
1659
1345
|
* This will declare the props for the compiler.
|
|
1660
1346
|
*
|
|
@@ -1675,12 +1361,12 @@ class we extends m {
|
|
|
1675
1361
|
* @returns {object}
|
|
1676
1362
|
*/
|
|
1677
1363
|
render() {
|
|
1678
|
-
return
|
|
1679
|
-
|
|
1364
|
+
return I({ class: `tab items-center justify-center rounded-md bg-muted p-1 text-muted-foreground ${this.class}` }, [
|
|
1365
|
+
w({
|
|
1680
1366
|
class: "flex flex-auto flex-row",
|
|
1681
|
-
map: [this.options, (
|
|
1367
|
+
map: [this.options, (e) => this.addLink(e)],
|
|
1682
1368
|
watch: {
|
|
1683
|
-
value: ["[[path]]",
|
|
1369
|
+
value: ["[[path]]", y.data],
|
|
1684
1370
|
callBack: this.updateLinks.bind(this)
|
|
1685
1371
|
}
|
|
1686
1372
|
})
|
|
@@ -1692,8 +1378,8 @@ class we extends m {
|
|
|
1692
1378
|
* @returns {void}
|
|
1693
1379
|
*/
|
|
1694
1380
|
afterSetup() {
|
|
1695
|
-
const
|
|
1696
|
-
this.updateLinks(
|
|
1381
|
+
const e = y.data.path;
|
|
1382
|
+
this.updateLinks(e);
|
|
1697
1383
|
}
|
|
1698
1384
|
/**
|
|
1699
1385
|
* This will update the links.
|
|
@@ -1701,12 +1387,12 @@ class we extends m {
|
|
|
1701
1387
|
* @param {string} value
|
|
1702
1388
|
* @returns {void}
|
|
1703
1389
|
*/
|
|
1704
|
-
updateLinks(
|
|
1390
|
+
updateLinks(e) {
|
|
1705
1391
|
let s = !1, a = this.links[0];
|
|
1706
1392
|
this.deactivateAllLinks();
|
|
1707
|
-
for (const
|
|
1708
|
-
if (
|
|
1709
|
-
this.updateLink(
|
|
1393
|
+
for (const i of this.links)
|
|
1394
|
+
if (i.rendered !== !1 && (s = Xe(i, e), s === !0)) {
|
|
1395
|
+
this.updateLink(i, !0);
|
|
1710
1396
|
break;
|
|
1711
1397
|
}
|
|
1712
1398
|
s !== !0 && a && this.updateLink(a, !0);
|
|
@@ -1717,8 +1403,8 @@ class we extends m {
|
|
|
1717
1403
|
* @returns {void}
|
|
1718
1404
|
*/
|
|
1719
1405
|
deactivateAllLinks() {
|
|
1720
|
-
for (const
|
|
1721
|
-
this.updateLink(
|
|
1406
|
+
for (const e of this.links)
|
|
1407
|
+
this.updateLink(e, !1);
|
|
1722
1408
|
}
|
|
1723
1409
|
/**
|
|
1724
1410
|
* This will update the link.
|
|
@@ -1727,8 +1413,8 @@ class we extends m {
|
|
|
1727
1413
|
* @param {boolean} selected
|
|
1728
1414
|
* @returns {void}
|
|
1729
1415
|
*/
|
|
1730
|
-
updateLink(
|
|
1731
|
-
|
|
1416
|
+
updateLink(e, s) {
|
|
1417
|
+
e.update(s);
|
|
1732
1418
|
}
|
|
1733
1419
|
/**
|
|
1734
1420
|
* This will add a link.
|
|
@@ -1736,9 +1422,9 @@ class we extends m {
|
|
|
1736
1422
|
* @param {object} option
|
|
1737
1423
|
* @returns {object}
|
|
1738
1424
|
*/
|
|
1739
|
-
addLink({ label:
|
|
1740
|
-
const
|
|
1741
|
-
return this.links.push(
|
|
1425
|
+
addLink({ label: e, href: s, exact: a }) {
|
|
1426
|
+
const i = qe({ text: e, href: s, exact: a });
|
|
1427
|
+
return this.links.push(i), i;
|
|
1742
1428
|
}
|
|
1743
1429
|
/**
|
|
1744
1430
|
* This will remove all the links.
|
|
@@ -1749,7 +1435,7 @@ class we extends m {
|
|
|
1749
1435
|
this.links = [];
|
|
1750
1436
|
}
|
|
1751
1437
|
}
|
|
1752
|
-
class
|
|
1438
|
+
class wt extends h {
|
|
1753
1439
|
/**
|
|
1754
1440
|
* This will declare the props for the compiler.
|
|
1755
1441
|
*
|
|
@@ -1765,11 +1451,11 @@ class He extends m {
|
|
|
1765
1451
|
*/
|
|
1766
1452
|
render() {
|
|
1767
1453
|
return o({ class: "tab-panel" }, [
|
|
1768
|
-
new
|
|
1454
|
+
new Ke({
|
|
1769
1455
|
class: this.class,
|
|
1770
1456
|
options: this.options
|
|
1771
1457
|
}),
|
|
1772
|
-
|
|
1458
|
+
z({
|
|
1773
1459
|
class: "tab-content",
|
|
1774
1460
|
switch: this.addGroup()
|
|
1775
1461
|
})
|
|
@@ -1781,21 +1467,21 @@ class He extends m {
|
|
|
1781
1467
|
* @returns {array}
|
|
1782
1468
|
*/
|
|
1783
1469
|
addGroup() {
|
|
1784
|
-
let
|
|
1470
|
+
let e;
|
|
1785
1471
|
const s = [], a = this.options;
|
|
1786
|
-
for (let
|
|
1787
|
-
|
|
1472
|
+
for (let i = 0, n = a.length; i < n; i++)
|
|
1473
|
+
e = a[i], s.push(
|
|
1788
1474
|
{
|
|
1789
|
-
uri:
|
|
1790
|
-
component:
|
|
1791
|
-
title:
|
|
1475
|
+
uri: e.uri || e.href,
|
|
1476
|
+
component: e.component,
|
|
1477
|
+
title: e.title || null,
|
|
1792
1478
|
persist: !0
|
|
1793
1479
|
}
|
|
1794
1480
|
);
|
|
1795
1481
|
return s;
|
|
1796
1482
|
}
|
|
1797
1483
|
}
|
|
1798
|
-
class
|
|
1484
|
+
class Ge extends h {
|
|
1799
1485
|
/**
|
|
1800
1486
|
* Runs before rendering, sets up defaults, a timer for drawing,
|
|
1801
1487
|
* and basic canvas properties.
|
|
@@ -1804,8 +1490,8 @@ class be extends m {
|
|
|
1804
1490
|
*/
|
|
1805
1491
|
onCreated() {
|
|
1806
1492
|
this.lineWidth = this.lineWidth || 3, this.lineColor = this.lineColor || "#000000", this.canvas = null, this.ctx = null, this.status = "stopped";
|
|
1807
|
-
const
|
|
1808
|
-
this.timer = new
|
|
1493
|
+
const e = 1e3 / 60;
|
|
1494
|
+
this.timer = new se(e, this.draw.bind(this)), this.width = 0, this.height = 0, this.signed = !1, this.mouse = { x: 0, y: 0, status: "up" }, this.margin = this.margin || { x: 40, y: 60 }, this.targetSize = this.targetSize || { width: 740, height: 345 }, this.baseLineWidth = this.baseLineWidth || 2, this.baseStrokeColor = this.baseStrokeColor || "#000000";
|
|
1809
1495
|
}
|
|
1810
1496
|
/**
|
|
1811
1497
|
* Renders a <canvas> element.
|
|
@@ -1813,7 +1499,7 @@ class be extends m {
|
|
|
1813
1499
|
* @returns {object} Layout definition for the canvas.
|
|
1814
1500
|
*/
|
|
1815
1501
|
render() {
|
|
1816
|
-
return
|
|
1502
|
+
return K({
|
|
1817
1503
|
style: "touch-action: none; -webkit-user-select: none; -webkit-touch-callout: none;"
|
|
1818
1504
|
});
|
|
1819
1505
|
}
|
|
@@ -1843,13 +1529,13 @@ class be extends m {
|
|
|
1843
1529
|
* @returns {Array} An array of [eventName, element, callback] definitions.
|
|
1844
1530
|
*/
|
|
1845
1531
|
setupEvents() {
|
|
1846
|
-
const
|
|
1532
|
+
const e = this.panel, s = this.pointerPosition.bind(this), a = this.pointerUp.bind(this), i = this.pointerDown.bind(this), n = this.resize.bind(this), l = { passive: !1 };
|
|
1847
1533
|
return [
|
|
1848
|
-
["pointermove",
|
|
1849
|
-
["pointerup",
|
|
1850
|
-
["pointerdown",
|
|
1851
|
-
["pointerout",
|
|
1852
|
-
["resize", globalThis,
|
|
1534
|
+
["pointermove", e, s, l],
|
|
1535
|
+
["pointerup", e, a],
|
|
1536
|
+
["pointerdown", e, i, l],
|
|
1537
|
+
["pointerout", e, a],
|
|
1538
|
+
["resize", globalThis, n]
|
|
1853
1539
|
];
|
|
1854
1540
|
}
|
|
1855
1541
|
/**
|
|
@@ -1858,16 +1544,16 @@ class be extends m {
|
|
|
1858
1544
|
* @param {Event} e The event object (mouse or touch).
|
|
1859
1545
|
* @returns {void}
|
|
1860
1546
|
*/
|
|
1861
|
-
getEventPosition(
|
|
1547
|
+
getEventPosition(e) {
|
|
1862
1548
|
let s, a;
|
|
1863
|
-
const
|
|
1864
|
-
if (
|
|
1865
|
-
const
|
|
1866
|
-
s =
|
|
1549
|
+
const i = this.canvas, n = i.width / parseInt(i.style.width), l = i.getBoundingClientRect();
|
|
1550
|
+
if (e.touches && e.touches.length) {
|
|
1551
|
+
const f = e.touches[0];
|
|
1552
|
+
s = f.clientX, a = f.clientY;
|
|
1867
1553
|
} else
|
|
1868
|
-
s =
|
|
1869
|
-
const
|
|
1870
|
-
this.mouse.x =
|
|
1554
|
+
s = e.x || e.clientX, a = e.y || e.clientY;
|
|
1555
|
+
const u = parseInt((s - l.left) * n), c = parseInt((a - l.top) * n);
|
|
1556
|
+
this.mouse.x = u, this.mouse.y = c;
|
|
1871
1557
|
}
|
|
1872
1558
|
/**
|
|
1873
1559
|
* Called when the pointer goes down on the canvas.
|
|
@@ -1876,8 +1562,8 @@ class be extends m {
|
|
|
1876
1562
|
* @param {Event} e The event object.
|
|
1877
1563
|
* @returns {void}
|
|
1878
1564
|
*/
|
|
1879
|
-
pointerDown(
|
|
1880
|
-
|
|
1565
|
+
pointerDown(e) {
|
|
1566
|
+
e.preventDefault(), e.stopPropagation(), this.getEventPosition(e);
|
|
1881
1567
|
const { ctx: s, mouse: a } = this;
|
|
1882
1568
|
s.beginPath(), s.moveTo(a.x, a.y), a.status = "down", this.startTimer();
|
|
1883
1569
|
}
|
|
@@ -1888,8 +1574,8 @@ class be extends m {
|
|
|
1888
1574
|
* @param {Event} e The event object.
|
|
1889
1575
|
* @returns {void}
|
|
1890
1576
|
*/
|
|
1891
|
-
pointerUp(
|
|
1892
|
-
|
|
1577
|
+
pointerUp(e) {
|
|
1578
|
+
e.preventDefault(), e.stopPropagation(), this.ctx.closePath(), this.mouse.status = "up", this.stopTimer();
|
|
1893
1579
|
}
|
|
1894
1580
|
/**
|
|
1895
1581
|
* Tracks pointer movement, updates position in real time.
|
|
@@ -1897,8 +1583,8 @@ class be extends m {
|
|
|
1897
1583
|
* @param {Event} e The event object.
|
|
1898
1584
|
* @returns {void}
|
|
1899
1585
|
*/
|
|
1900
|
-
pointerPosition(
|
|
1901
|
-
this.getEventPosition(
|
|
1586
|
+
pointerPosition(e) {
|
|
1587
|
+
this.getEventPosition(e), this.mouse.status === "down" && (e.preventDefault(), e.stopPropagation());
|
|
1902
1588
|
}
|
|
1903
1589
|
/**
|
|
1904
1590
|
* Resizes the canvas, preserves existing drawing by converting
|
|
@@ -1907,12 +1593,12 @@ class be extends m {
|
|
|
1907
1593
|
* @returns {void}
|
|
1908
1594
|
*/
|
|
1909
1595
|
resize() {
|
|
1910
|
-
const { canvas:
|
|
1596
|
+
const { canvas: e, ctx: s } = this, a = e.toDataURL();
|
|
1911
1597
|
if (this.scale(), this.setupBackground(s), a !== "data:,") {
|
|
1912
|
-
const
|
|
1913
|
-
|
|
1914
|
-
s.drawImage(
|
|
1915
|
-
}),
|
|
1598
|
+
const i = new globalThis.Image();
|
|
1599
|
+
M.on("load", i, function n() {
|
|
1600
|
+
s.drawImage(i, 0, 0), M.off("load", i, n);
|
|
1601
|
+
}), i.src = a;
|
|
1916
1602
|
}
|
|
1917
1603
|
this.draw();
|
|
1918
1604
|
}
|
|
@@ -1931,8 +1617,8 @@ class be extends m {
|
|
|
1931
1617
|
* @returns {void}
|
|
1932
1618
|
*/
|
|
1933
1619
|
noScaleResize() {
|
|
1934
|
-
const
|
|
1935
|
-
this.width = canvas.width =
|
|
1620
|
+
const e = R.getSize(container);
|
|
1621
|
+
this.width = canvas.width = e.width, this.height = canvas.height = e.height;
|
|
1936
1622
|
}
|
|
1937
1623
|
/**
|
|
1938
1624
|
* Scales the canvas to fit within its container, preserving aspect ratio
|
|
@@ -1941,13 +1627,13 @@ class be extends m {
|
|
|
1941
1627
|
* @returns {void}
|
|
1942
1628
|
*/
|
|
1943
1629
|
scale() {
|
|
1944
|
-
const
|
|
1945
|
-
let
|
|
1946
|
-
if (this.width =
|
|
1947
|
-
const
|
|
1948
|
-
|
|
1630
|
+
const e = this.canvas, s = this.container, a = R.getSize(s), i = this.targetSize, n = i.width, l = i.height;
|
|
1631
|
+
let u = n + "px", c = l + "px";
|
|
1632
|
+
if (this.width = e.width = n, this.height = e.height = l, a.width !== 0 && a.height !== 0) {
|
|
1633
|
+
const f = a.width, g = a.height, r = f / n, m = g / l, b = Math.min(r, m);
|
|
1634
|
+
u = n * b + "px", c = l * b + "px";
|
|
1949
1635
|
}
|
|
1950
|
-
|
|
1636
|
+
e.style.width = u, e.style.height = c;
|
|
1951
1637
|
}
|
|
1952
1638
|
/**
|
|
1953
1639
|
* Main drawing loop. If the mouse is down, adds a line
|
|
@@ -1964,11 +1650,11 @@ class be extends m {
|
|
|
1964
1650
|
* @param {CanvasRenderingContext2D} ctx The canvas 2D context.
|
|
1965
1651
|
* @returns {void}
|
|
1966
1652
|
*/
|
|
1967
|
-
drawBottomLine(
|
|
1653
|
+
drawBottomLine(e) {
|
|
1968
1654
|
const s = this.canvas;
|
|
1969
|
-
|
|
1970
|
-
const a = this.margin.x,
|
|
1971
|
-
|
|
1655
|
+
e.globalAlpha = 1, e.shadowBlur = 0;
|
|
1656
|
+
const a = this.margin.x, i = this.height - this.margin.y;
|
|
1657
|
+
e.beginPath(), e.moveTo(a, i), e.lineTo(s.width - this.margin.x, i), e.lineWidth = this.baseLineWidth, e.strokeStyle = this.baseStrokeColor, e.stroke(), e.closePath();
|
|
1972
1658
|
}
|
|
1973
1659
|
/**
|
|
1974
1660
|
* Adds a line to the current path, updating the 'signed' status.
|
|
@@ -1979,10 +1665,10 @@ class be extends m {
|
|
|
1979
1665
|
* @param {string} color The stroke color.
|
|
1980
1666
|
* @returns {void}
|
|
1981
1667
|
*/
|
|
1982
|
-
addLine(
|
|
1668
|
+
addLine(e, s, a, i) {
|
|
1983
1669
|
this.signed || (this.signed = !0);
|
|
1984
|
-
const
|
|
1985
|
-
|
|
1670
|
+
const n = Math.round(s), l = Math.round(a);
|
|
1671
|
+
e.lineWidth = this.lineWidth, e.strokeStyle = i, e.lineTo(n, l), e.stroke();
|
|
1986
1672
|
}
|
|
1987
1673
|
/**
|
|
1988
1674
|
* Clears the canvas, sets signed to false, and re-initializes
|
|
@@ -1992,8 +1678,8 @@ class be extends m {
|
|
|
1992
1678
|
*/
|
|
1993
1679
|
reset() {
|
|
1994
1680
|
this.signed = !1;
|
|
1995
|
-
const { ctx:
|
|
1996
|
-
|
|
1681
|
+
const { ctx: e } = this;
|
|
1682
|
+
e.clearRect(0, 0, this.width, this.height), this.setupBackground(e);
|
|
1997
1683
|
}
|
|
1998
1684
|
/**
|
|
1999
1685
|
* Fills the canvas background with white and draws the baseline.
|
|
@@ -2001,8 +1687,8 @@ class be extends m {
|
|
|
2001
1687
|
* @param {CanvasRenderingContext2D} ctx The canvas context.
|
|
2002
1688
|
* @returns {void}
|
|
2003
1689
|
*/
|
|
2004
|
-
setupBackground(
|
|
2005
|
-
|
|
1690
|
+
setupBackground(e) {
|
|
1691
|
+
e.fillStyle = "transparent", e.fillRect(0, 0, this.width, this.height), this.drawBottomLine(e);
|
|
2006
1692
|
}
|
|
2007
1693
|
/**
|
|
2008
1694
|
* Starts the drawing timer so new lines can be added as pointer moves.
|
|
@@ -2021,7 +1707,7 @@ class be extends m {
|
|
|
2021
1707
|
this.timer.stop(), this.status = "stopped";
|
|
2022
1708
|
}
|
|
2023
1709
|
}
|
|
2024
|
-
class
|
|
1710
|
+
class bt extends h {
|
|
2025
1711
|
/**
|
|
2026
1712
|
* Sets up default properties for the signature panel.
|
|
2027
1713
|
*
|
|
@@ -2038,19 +1724,19 @@ class Ee extends m {
|
|
|
2038
1724
|
*/
|
|
2039
1725
|
render() {
|
|
2040
1726
|
return o({ class: "signature-panel relative flex flex-auto overflow-hidden select-none" }, [
|
|
2041
|
-
|
|
1727
|
+
ne({
|
|
2042
1728
|
cache: "hiddenInput",
|
|
2043
1729
|
required: !0,
|
|
2044
1730
|
bind: this.path + ".data"
|
|
2045
1731
|
}),
|
|
2046
1732
|
o({ class: "absolute top-2 right-2" }, [
|
|
2047
|
-
|
|
1733
|
+
T({
|
|
2048
1734
|
variant: "icon",
|
|
2049
|
-
icon:
|
|
1735
|
+
icon: x.circleX,
|
|
2050
1736
|
click: this.reset.bind(this)
|
|
2051
1737
|
})
|
|
2052
1738
|
]),
|
|
2053
|
-
new
|
|
1739
|
+
new Ge({
|
|
2054
1740
|
cache: "canvasLayer",
|
|
2055
1741
|
margin: this.margin,
|
|
2056
1742
|
targetSize: this.targetSize,
|
|
@@ -2094,43 +1780,42 @@ class Ee extends m {
|
|
|
2094
1780
|
* @param {Event} [e] The event object (if called by a click event).
|
|
2095
1781
|
* @returns {void}
|
|
2096
1782
|
*/
|
|
2097
|
-
reset(
|
|
1783
|
+
reset(e) {
|
|
2098
1784
|
if (this.canvasLayer)
|
|
2099
1785
|
return this.canvasLayer.reset();
|
|
2100
1786
|
}
|
|
2101
1787
|
}
|
|
2102
1788
|
export {
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
Ee as t
|
|
1789
|
+
ht as B,
|
|
1790
|
+
be as C,
|
|
1791
|
+
xe as D,
|
|
1792
|
+
ye as H,
|
|
1793
|
+
ft as I,
|
|
1794
|
+
dt as N,
|
|
1795
|
+
A as O,
|
|
1796
|
+
at as P,
|
|
1797
|
+
rt as S,
|
|
1798
|
+
B as T,
|
|
1799
|
+
Re as U,
|
|
1800
|
+
ot as W,
|
|
1801
|
+
he as a,
|
|
1802
|
+
W as b,
|
|
1803
|
+
ce as c,
|
|
1804
|
+
it as d,
|
|
1805
|
+
nt as e,
|
|
1806
|
+
fe as f,
|
|
1807
|
+
de as g,
|
|
1808
|
+
me as h,
|
|
1809
|
+
pe as i,
|
|
1810
|
+
j,
|
|
1811
|
+
lt as k,
|
|
1812
|
+
ct as l,
|
|
1813
|
+
ut as m,
|
|
1814
|
+
gt as n,
|
|
1815
|
+
Ne as o,
|
|
1816
|
+
mt as p,
|
|
1817
|
+
pt as q,
|
|
1818
|
+
Ke as r,
|
|
1819
|
+
wt as s,
|
|
1820
|
+
bt as t
|
|
2136
1821
|
};
|