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