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