@base-framework/ui 0.0.16 → 0.0.19
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 +56 -55
- package/dist/organisms.es.js +41 -40
- package/dist/{tab-BjiQGl_0.js → signature-CzIRh6RC.js} +486 -172
- package/dist/types/components/organisms/organisms.d.ts +1 -0
- package/dist/types/components/organisms/signature/signature-canvas.d.ts +144 -0
- package/dist/types/components/organisms/signature/signature.d.ts +55 -0
- package/dist/types/utils/scaling/image-scaler/element-scaler.d.ts +72 -0
- package/dist/types/utils/scaling/image-scaler/event-controller.d.ts +204 -0
- package/dist/types/utils/scaling/image-scaler/image-scaler.d.ts +150 -0
- package/dist/types/utils/utils.d.ts +0 -0
- package/dist/utils.es.js +1 -0
- package/package.json +5 -1
- package/dist/style.css +0 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { Button as
|
|
2
|
-
import { Atom as
|
|
3
|
-
import { B
|
|
4
|
-
import { Icons as
|
|
5
|
-
import { TableBody as K, List as _ } from "@base-framework/organisms";
|
|
6
|
-
import { C as
|
|
7
|
-
import { A as
|
|
8
|
-
|
|
1
|
+
import { Button as v, Div as o, On as U, Span as D, Th as O, UseParent as F, I as Y, Thead as E, Tr as H, Table as Q, P as w, Li as S, Time as X, Nav as L, Ul as x, Section as P } from "@base-framework/atoms";
|
|
2
|
+
import { Atom as u, Component as g, Data as C, DateTime as q, Jot as R, router as y, NavLink as M, base as f, Dom as I } from "@base-framework/base";
|
|
3
|
+
import { B, I as z } from "./icon-B9QUT2NY.js";
|
|
4
|
+
import { Icons as b } from "./icons.es.js";
|
|
5
|
+
import { TableBody as K, List as _, IntervalTimer as G } from "@base-framework/organisms";
|
|
6
|
+
import { C as V, I as J, H as Z } from "./inputs-O_WkdbI3.js";
|
|
7
|
+
import { A as ee, P as te } from "./calendar-B5TK6tLi.js";
|
|
8
|
+
u((t, e) => ({
|
|
9
9
|
class: "flex items-center px-4 py-2",
|
|
10
10
|
...t,
|
|
11
11
|
children: e
|
|
12
12
|
}));
|
|
13
|
-
|
|
13
|
+
u(({ value: t, label: e }) => 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
15
|
onState: ["performance", { active: t }],
|
|
16
16
|
dataSet: ["performance", ["state", t, "active"]],
|
|
17
17
|
click: (s, { state: n }) => n.performance = t
|
|
18
18
|
}, e));
|
|
19
|
-
class
|
|
19
|
+
class Ke extends g {
|
|
20
20
|
/**
|
|
21
21
|
* This will declare the props for the compiler.
|
|
22
22
|
*
|
|
@@ -34,55 +34,55 @@ class Ee extends u {
|
|
|
34
34
|
return o({ class: this.class || "" }, this.children);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
const
|
|
37
|
+
const se = (t) => {
|
|
38
38
|
const e = new Date(t, 11, 31), s = new Date(t, 0, 1);
|
|
39
39
|
return e.getDay() === 4 || // December 31 is a Thursday
|
|
40
40
|
s.getDay() === 4;
|
|
41
|
-
},
|
|
41
|
+
}, ne = (t) => {
|
|
42
42
|
const e = new Date(t.valueOf()), s = (e.getDay() + 6) % 7;
|
|
43
43
|
e.setDate(e.getDate() - s + 3);
|
|
44
44
|
const n = e.getFullYear(), a = new Date(n, 0, 4);
|
|
45
45
|
a.setDate(a.getDate() - (a.getDay() + 6) % 7);
|
|
46
46
|
const i = Math.ceil((e - a) / 6048e5) + 1;
|
|
47
|
-
return i > 52 && !
|
|
47
|
+
return i > 52 && !se(n) ? {
|
|
48
48
|
weekNumber: 1,
|
|
49
49
|
year: n + 1
|
|
50
50
|
} : {
|
|
51
51
|
weekNumber: i,
|
|
52
52
|
year: n
|
|
53
53
|
};
|
|
54
|
-
},
|
|
54
|
+
}, ae = (t, e, s) => {
|
|
55
55
|
if (s === 0) return [];
|
|
56
56
|
const n = new Date(t, e, 0).getDate();
|
|
57
57
|
return Array.from(
|
|
58
58
|
{ length: s },
|
|
59
59
|
(a, i) => new Date(t, e - 1, n - s + i + 1)
|
|
60
60
|
);
|
|
61
|
-
},
|
|
61
|
+
}, ie = (t, e, s) => Array.from({ length: s }, (n, a) => new Date(t, e + 1, a + 1)), T = (t, e) => {
|
|
62
62
|
const s = new Date(e, 0, 4), n = (s.getDay() + 6) % 7, a = new Date(s);
|
|
63
63
|
a.setDate(s.getDate() - n);
|
|
64
64
|
const i = new Date(a);
|
|
65
65
|
return i.setDate(a.getDate() + (t - 1) * 7), i;
|
|
66
|
-
},
|
|
66
|
+
}, _e = (t, e) => {
|
|
67
67
|
const s = new Date(t, e, 1).getDay(), n = new Date(t, e + 1, 0).getDate(), a = [];
|
|
68
68
|
let i = [];
|
|
69
|
-
for (let
|
|
70
|
-
const
|
|
71
|
-
i.push(
|
|
69
|
+
for (let l = 1 - s; l <= n; l++) {
|
|
70
|
+
const d = new Date(t, e, l);
|
|
71
|
+
i.push(l > 0 ? d : null), (i.length === 7 || l === n) && (a.push([...i]), i = []);
|
|
72
72
|
}
|
|
73
73
|
return a;
|
|
74
|
-
},
|
|
74
|
+
}, Ge = (t, e) => {
|
|
75
75
|
const s = new Date(t, e + 1, 0).getDate(), n = [];
|
|
76
76
|
let a = [];
|
|
77
77
|
for (let i = 1; i <= s; i++)
|
|
78
78
|
a.push(new Date(t, e, i)), a.length === 7 && (n.push(a), a = []);
|
|
79
79
|
return a.length > 0 && n.push(a), n;
|
|
80
|
-
},
|
|
80
|
+
}, oe = (t, e, s) => {
|
|
81
81
|
const n = /* @__PURE__ */ new Date();
|
|
82
82
|
return n.getDate() === t && n.getMonth() === e && n.getFullYear() === s;
|
|
83
|
-
},
|
|
84
|
-
const i =
|
|
85
|
-
return
|
|
83
|
+
}, le = ({ day: t, month: e, year: s, weekNumber: n, selectWeek: a }) => {
|
|
84
|
+
const i = oe(t, e, s);
|
|
85
|
+
return v({
|
|
86
86
|
text: t || "",
|
|
87
87
|
disabled: !t,
|
|
88
88
|
class: `
|
|
@@ -92,19 +92,19 @@ const X = (t) => {
|
|
|
92
92
|
`,
|
|
93
93
|
click: () => a(n, s)
|
|
94
94
|
});
|
|
95
|
-
},
|
|
96
|
-
const s = new Date(t, e, 1).getDay(), n = new Date(t, e + 1, 0).getDate(), a =
|
|
97
|
-
for (let
|
|
98
|
-
const
|
|
99
|
-
|
|
95
|
+
}, re = (t, e) => {
|
|
96
|
+
const s = new Date(t, e, 1).getDay(), n = new Date(t, e + 1, 0).getDate(), a = ae(t, e, s), i = Array.from({ length: n }, (r, m) => new Date(t, e, m + 1)), l = (a.length + i.length) % 7, d = l === 0 ? 0 : 7 - l, c = ie(t, e, d), h = [...a, ...i, ...c], p = [];
|
|
97
|
+
for (let r = 0; r < h.length; r += 7) {
|
|
98
|
+
const m = h.slice(r, r + 7), k = m.find((j) => j) || new Date(t, e, 1), { weekNumber: $, year: A } = ne(k);
|
|
99
|
+
p.push({
|
|
100
100
|
weekNumber: $,
|
|
101
|
-
year:
|
|
102
|
-
days:
|
|
101
|
+
year: A,
|
|
102
|
+
days: m
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
|
-
return
|
|
106
|
-
},
|
|
107
|
-
const { year: a, month: i, currentDate:
|
|
105
|
+
return p;
|
|
106
|
+
}, ce = ({ selectWeek: t }) => U("month", (e, s, { data: n }) => {
|
|
107
|
+
const { year: a, month: i, currentDate: l } = n, d = re(a, i);
|
|
108
108
|
return o(
|
|
109
109
|
{ class: "grid grid-cols-8 gap-1 text-sm px-4 py-2" },
|
|
110
110
|
[
|
|
@@ -115,12 +115,12 @@ const X = (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
|
-
(c) =>
|
|
118
|
+
(c) => D({ class: "px-1 py-1", text: c })
|
|
119
119
|
)
|
|
120
120
|
),
|
|
121
121
|
// Render each "week" row
|
|
122
|
-
...
|
|
123
|
-
({ weekNumber: c, days:
|
|
122
|
+
...d.map(
|
|
123
|
+
({ weekNumber: c, days: h, year: p }) => o({
|
|
124
124
|
class: "grid grid-cols-8 col-span-8 items-center ring-primary rounded-sm px-1",
|
|
125
125
|
onSet: ["currentWeek", {
|
|
126
126
|
ring: c
|
|
@@ -129,7 +129,7 @@ const X = (t) => {
|
|
|
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: () => t(c,
|
|
132
|
+
click: () => t(c, p),
|
|
133
133
|
// If you have a 'currentWeek' state, you can highlight it with 'onSet'
|
|
134
134
|
onSet: ["currentWeek", {
|
|
135
135
|
"text-primary-foreground": c,
|
|
@@ -140,14 +140,14 @@ const X = (t) => {
|
|
|
140
140
|
// The 7 cells for each day in the row
|
|
141
141
|
o(
|
|
142
142
|
{ class: "grid grid-cols-7 col-span-7 text-center" },
|
|
143
|
-
|
|
144
|
-
(
|
|
145
|
-
year: (
|
|
146
|
-
month: (
|
|
147
|
-
day: (
|
|
148
|
-
week:
|
|
143
|
+
h.map(
|
|
144
|
+
(r) => le({
|
|
145
|
+
year: (r == null ? void 0 : r.getFullYear()) || null,
|
|
146
|
+
month: (r == null ? void 0 : r.getMonth()) || null,
|
|
147
|
+
day: (r == null ? void 0 : r.getDate()) || null,
|
|
148
|
+
week: h,
|
|
149
149
|
weekNumber: c,
|
|
150
|
-
currentDate:
|
|
150
|
+
currentDate: l,
|
|
151
151
|
selectWeek: t
|
|
152
152
|
})
|
|
153
153
|
)
|
|
@@ -156,7 +156,7 @@ const X = (t) => {
|
|
|
156
156
|
)
|
|
157
157
|
]
|
|
158
158
|
);
|
|
159
|
-
}),
|
|
159
|
+
}), W = ({ label: t, click: e }) => B(
|
|
160
160
|
{
|
|
161
161
|
class: `
|
|
162
162
|
inline-flex items-center justify-center h-7 w-7 bg-transparent p-0
|
|
@@ -167,20 +167,20 @@ const X = (t) => {
|
|
|
167
167
|
click: e,
|
|
168
168
|
"aria-label": `${t} month`,
|
|
169
169
|
variant: "icon",
|
|
170
|
-
icon: t === "Previous" ?
|
|
170
|
+
icon: t === "Previous" ? b.chevron.single.left : b.chevron.single.right
|
|
171
171
|
}
|
|
172
|
-
),
|
|
173
|
-
|
|
174
|
-
|
|
172
|
+
), de = ({ next: t, previous: e }) => o({ class: "flex flex-auto min-h-12 text-sm font-medium relative justify-center items-center" }, [
|
|
173
|
+
D("[[monthName]] [[year]]"),
|
|
174
|
+
W({
|
|
175
175
|
label: "Previous",
|
|
176
176
|
click: e
|
|
177
177
|
}),
|
|
178
|
-
|
|
178
|
+
W({
|
|
179
179
|
label: "Next",
|
|
180
180
|
click: t
|
|
181
181
|
})
|
|
182
182
|
]);
|
|
183
|
-
class
|
|
183
|
+
class Ve extends g {
|
|
184
184
|
/**
|
|
185
185
|
* This will declare the props for the compiler.
|
|
186
186
|
*
|
|
@@ -195,8 +195,8 @@ class Ke extends u {
|
|
|
195
195
|
* @returns {Data}
|
|
196
196
|
*/
|
|
197
197
|
setData() {
|
|
198
|
-
const e = /* @__PURE__ */ new Date(), s = this.selectedWeek || this.calculateCurrentWeek(e), n =
|
|
199
|
-
return new
|
|
198
|
+
const e = /* @__PURE__ */ new Date(), s = this.selectedWeek || this.calculateCurrentWeek(e), n = T(s, e.getFullYear());
|
|
199
|
+
return new C({
|
|
200
200
|
monthName: this.getMonthName(n.getMonth()),
|
|
201
201
|
year: n.getFullYear(),
|
|
202
202
|
month: n.getMonth(),
|
|
@@ -233,7 +233,7 @@ class Ke extends u {
|
|
|
233
233
|
* @returns {string}
|
|
234
234
|
*/
|
|
235
235
|
getMonthName(e) {
|
|
236
|
-
return
|
|
236
|
+
return q.monthNames[e];
|
|
237
237
|
}
|
|
238
238
|
/**
|
|
239
239
|
* Updates the calendar to show the previous month.
|
|
@@ -278,7 +278,7 @@ class Ke extends u {
|
|
|
278
278
|
*/
|
|
279
279
|
selectWeek(e, s) {
|
|
280
280
|
this.data.currentWeek = e;
|
|
281
|
-
const n =
|
|
281
|
+
const n = T(e, s);
|
|
282
282
|
this.setDate(n.getMonth(), n.getFullYear(), n.getDate()), typeof this.selectedCallBack == "function" && this.selectedCallBack(e);
|
|
283
283
|
}
|
|
284
284
|
/**
|
|
@@ -288,33 +288,33 @@ class Ke extends u {
|
|
|
288
288
|
*/
|
|
289
289
|
render() {
|
|
290
290
|
return o({ class: "week-calendar-container border rounded-md bg-background p-3" }, [
|
|
291
|
-
|
|
291
|
+
de({
|
|
292
292
|
next: () => this.goToNextMonth(),
|
|
293
293
|
previous: () => this.goToPreviousMonth()
|
|
294
294
|
}),
|
|
295
|
-
|
|
295
|
+
ce({
|
|
296
296
|
selectWeek: (e, s) => this.selectWeek(e, s)
|
|
297
297
|
})
|
|
298
298
|
]);
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
]),
|
|
304
|
-
const
|
|
301
|
+
const he = (t) => O({ class: `cursor-pointer py-3 px-4 text-base w-10 ${t.class || ""}` }, [
|
|
302
|
+
F((e) => new V({ class: "mr-2", onChange: () => e.toggleAllSelectedRows() }))
|
|
303
|
+
]), ue = ({ align: t, sortable: e, key: s, label: n, sort: a, class: i }) => {
|
|
304
|
+
const l = t || "justify-start";
|
|
305
305
|
return O({
|
|
306
306
|
class: `cursor-pointer py-3 px-4 text-base ${i || ""}`,
|
|
307
307
|
click: e && (() => a(s))
|
|
308
308
|
}, [
|
|
309
|
-
o({ class: `flex flex-auto w-full items-center ${
|
|
310
|
-
|
|
311
|
-
e && Y({ class: "ml-2", html:
|
|
309
|
+
o({ class: `flex flex-auto w-full items-center ${l}` }, [
|
|
310
|
+
D(n),
|
|
311
|
+
e && Y({ class: "ml-2", html: b.arrows.upDown })
|
|
312
312
|
])
|
|
313
313
|
]);
|
|
314
|
-
},
|
|
315
|
-
|
|
314
|
+
}, ge = (t) => E([
|
|
315
|
+
H({
|
|
316
316
|
class: "text-muted-foreground border-b",
|
|
317
|
-
map: [t.headers, (e) => e.label === "checkbox" ?
|
|
317
|
+
map: [t.headers, (e) => e.label === "checkbox" ? he({ toggle: t.toggle }) : ue({
|
|
318
318
|
align: e.align,
|
|
319
319
|
sortable: e.sortable,
|
|
320
320
|
key: e.key,
|
|
@@ -322,13 +322,13 @@ const le = (t) => O({ class: `cursor-pointer py-3 px-4 text-base w-10 ${t.class
|
|
|
322
322
|
sort: t.sort
|
|
323
323
|
})]
|
|
324
324
|
})
|
|
325
|
-
]),
|
|
325
|
+
]), fe = ({ key: t, rows: e, selectRow: s, rowItem: n }) => new K({
|
|
326
326
|
cache: "table",
|
|
327
327
|
key: t,
|
|
328
328
|
items: e,
|
|
329
329
|
rowItem: (a) => n(a, s),
|
|
330
330
|
class: "divide-y divide-border"
|
|
331
|
-
}),
|
|
331
|
+
}), Je = R(
|
|
332
332
|
{
|
|
333
333
|
/**
|
|
334
334
|
* Initializes component data.
|
|
@@ -336,7 +336,7 @@ const le = (t) => O({ class: `cursor-pointer py-3 px-4 text-base w-10 ${t.class
|
|
|
336
336
|
* @returns {Data}
|
|
337
337
|
*/
|
|
338
338
|
setData() {
|
|
339
|
-
return new
|
|
339
|
+
return new C({
|
|
340
340
|
selectedRows: [],
|
|
341
341
|
selected: !1
|
|
342
342
|
});
|
|
@@ -398,12 +398,12 @@ const le = (t) => O({ class: `cursor-pointer py-3 px-4 text-base w-10 ${t.class
|
|
|
398
398
|
const t = this.rows, e = this.border !== !1 ? "border" : "";
|
|
399
399
|
return o({ class: "w-full" }, [
|
|
400
400
|
o({ class: `w-full rounded-md ${e} overflow-x-auto` }, [
|
|
401
|
-
|
|
401
|
+
Q({ class: "w-full" }, [
|
|
402
402
|
// @ts-ignore
|
|
403
|
-
this.headers &&
|
|
403
|
+
this.headers && ge({ headers: this.headers, sort: (s) => this.sortRows(s) }),
|
|
404
404
|
// @ts-ignore
|
|
405
405
|
this.customHeader ?? null,
|
|
406
|
-
|
|
406
|
+
fe({
|
|
407
407
|
// @ts-ignore
|
|
408
408
|
key: this.key,
|
|
409
409
|
rows: t,
|
|
@@ -476,45 +476,45 @@ const le = (t) => O({ class: `cursor-pointer py-3 px-4 text-base w-10 ${t.class
|
|
|
476
476
|
this.data.selectedRows = [];
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
|
-
),
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
])),
|
|
479
|
+
), pe = u(({ name: t, email: e }) => o({ class: "min-w-0 flex-auto" }, [
|
|
480
|
+
w({ class: "text-base font-semibold leading-6 m-0" }, t),
|
|
481
|
+
w({ class: "truncate text-sm leading-5 text-muted-foreground m-0" }, e)
|
|
482
|
+
])), me = () => o({ class: "flex items-center gap-x-1.5" }, [
|
|
483
483
|
o({ class: "flex-none rounded-full bg-emerald-500/20 p-1" }, [
|
|
484
484
|
o({ class: "h-1.5 w-1.5 rounded-full bg-emerald-500" })
|
|
485
485
|
]),
|
|
486
|
-
|
|
487
|
-
]),
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
]),
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
])),
|
|
486
|
+
w({ class: "text-xs leading-5 text-gray-500" }, "Online")
|
|
487
|
+
]), we = (t) => w({ class: "text-xs leading-5 text-muted-foreground" }, [
|
|
488
|
+
D("Last seen "),
|
|
489
|
+
X({ datetime: t }, "3h ago")
|
|
490
|
+
]), be = (t, e) => t === "online" ? me() : we(e), xe = u(({ role: t, lastSeen: e, status: s }) => o({ class: "hidden shrink-0 sm:flex sm:flex-col sm:items-end" }, [
|
|
491
|
+
w({ class: "text-sm leading-6 m-0" }, t),
|
|
492
|
+
be(s, e)
|
|
493
|
+
])), ke = (t) => t.split(" ").map((s) => s[0]).join(""), ye = u((t) => S({ class: "fadeIn flex justify-between gap-x-6 py-4 px-4 rounded-md hover:bg-muted/50" }, [
|
|
494
494
|
o({ class: "flex min-w-0 gap-x-4" }, [
|
|
495
|
-
|
|
496
|
-
|
|
495
|
+
ee({ src: t.image, alt: t.name, fallbackText: ke(t.name) }),
|
|
496
|
+
pe({ name: t.name, email: t.email })
|
|
497
497
|
]),
|
|
498
|
-
|
|
498
|
+
xe({
|
|
499
499
|
role: t.role,
|
|
500
500
|
lastSeen: t.lastSeen,
|
|
501
501
|
status: t.status
|
|
502
502
|
})
|
|
503
|
-
])),
|
|
503
|
+
])), Ze = u((t) => new _({
|
|
504
504
|
cache: "list",
|
|
505
505
|
key: "name",
|
|
506
506
|
items: t.users,
|
|
507
507
|
role: "list",
|
|
508
508
|
class: "divide-y divide-border",
|
|
509
|
-
rowItem:
|
|
510
|
-
})),
|
|
509
|
+
rowItem: ye
|
|
510
|
+
})), ve = (t, e) => e.includes(t), De = (t, e, s) => t.exact ? s === e : ve(e, s), Se = ({ text: t, href: e, exact: s, hidden: n }) => new M({
|
|
511
511
|
text: t,
|
|
512
512
|
href: e,
|
|
513
513
|
exact: s,
|
|
514
514
|
dataSet: ["selected", ["state", !0, "active"]],
|
|
515
515
|
class: `${n ? "hidden" : "inline-flex"} items-center justify-center whitespace-nowrap px-3 py-1.5 text-sm font-medium transition-all rounded-md focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-ring focus-visible:ring-offset-background hover:bg-primary hover:text-primary-foreground disabled:opacity-50 disabled:pointer-events-none data-[state=active]:bg-primary data-[state=active]:text-primary-foreground data-[state=active]:shadow-sm`
|
|
516
516
|
});
|
|
517
|
-
class
|
|
517
|
+
class et extends g {
|
|
518
518
|
/**
|
|
519
519
|
* This will declare the props for the compiler.
|
|
520
520
|
*
|
|
@@ -535,14 +535,14 @@ class Ve extends u {
|
|
|
535
535
|
* @returns {object}
|
|
536
536
|
*/
|
|
537
537
|
render() {
|
|
538
|
-
return
|
|
538
|
+
return L(
|
|
539
539
|
{ class: `flex items-center justify-center p-2 text-muted-foreground rounded-md ${this.class || ""}` },
|
|
540
540
|
[
|
|
541
|
-
|
|
541
|
+
x({
|
|
542
542
|
class: "flex space-x-4",
|
|
543
543
|
map: [this.options, (e) => this.addLink(e)],
|
|
544
544
|
watch: {
|
|
545
|
-
value: ["[[path]]",
|
|
545
|
+
value: ["[[path]]", y.data],
|
|
546
546
|
callBack: this.updateLinks.bind(this)
|
|
547
547
|
}
|
|
548
548
|
})
|
|
@@ -555,7 +555,7 @@ class Ve extends u {
|
|
|
555
555
|
* @returns {void}
|
|
556
556
|
*/
|
|
557
557
|
afterSetup() {
|
|
558
|
-
const e =
|
|
558
|
+
const e = y.data.path;
|
|
559
559
|
this.updateLinks(e);
|
|
560
560
|
}
|
|
561
561
|
/**
|
|
@@ -570,7 +570,7 @@ class Ve extends u {
|
|
|
570
570
|
for (const n of this.links) {
|
|
571
571
|
if (!n.rendered)
|
|
572
572
|
continue;
|
|
573
|
-
|
|
573
|
+
De(n, n.getLinkPath(), e) ? (this.updateLink(n, !0), s = !0) : this.updateLink(n, !1);
|
|
574
574
|
}
|
|
575
575
|
!s && this.links[0] && this.updateLink(this.links[0], !0);
|
|
576
576
|
}
|
|
@@ -600,7 +600,7 @@ class Ve extends u {
|
|
|
600
600
|
* @returns {object}
|
|
601
601
|
*/
|
|
602
602
|
addLink({ label: e, href: s, exact: n, hidden: a }) {
|
|
603
|
-
const i =
|
|
603
|
+
const i = Se({ text: e, href: s, exact: n, hidden: a });
|
|
604
604
|
return this.links.push(i), i;
|
|
605
605
|
}
|
|
606
606
|
/**
|
|
@@ -612,10 +612,10 @@ class Ve extends u {
|
|
|
612
612
|
this.links = [];
|
|
613
613
|
}
|
|
614
614
|
}
|
|
615
|
-
const
|
|
615
|
+
const tt = u((t) => {
|
|
616
616
|
const e = t.margin || "m-4 ml-0";
|
|
617
617
|
return o({ class: `flex-none ${e}` }, [
|
|
618
|
-
|
|
618
|
+
B({
|
|
619
619
|
variant: "icon",
|
|
620
620
|
class: "back-button",
|
|
621
621
|
click: () => {
|
|
@@ -626,11 +626,11 @@ const qe = d((t) => {
|
|
|
626
626
|
t.backUrl && app.navigate(t.backUrl);
|
|
627
627
|
}
|
|
628
628
|
}, [
|
|
629
|
-
|
|
629
|
+
z(b.arrows.left)
|
|
630
630
|
])
|
|
631
631
|
]);
|
|
632
632
|
});
|
|
633
|
-
class N extends
|
|
633
|
+
class N extends g {
|
|
634
634
|
/**
|
|
635
635
|
* This will declare the props for the compiler.
|
|
636
636
|
*
|
|
@@ -717,7 +717,7 @@ class N extends u {
|
|
|
717
717
|
return this.children;
|
|
718
718
|
}
|
|
719
719
|
}
|
|
720
|
-
class
|
|
720
|
+
class st extends N {
|
|
721
721
|
/**
|
|
722
722
|
* This will stop presistence.
|
|
723
723
|
*
|
|
@@ -820,7 +820,7 @@ class Je extends N {
|
|
|
820
820
|
document.documentElement.style.overflowY = "auto";
|
|
821
821
|
}
|
|
822
822
|
}
|
|
823
|
-
class
|
|
823
|
+
class nt extends N {
|
|
824
824
|
/**
|
|
825
825
|
* This will get the overlay type.
|
|
826
826
|
*
|
|
@@ -839,7 +839,7 @@ class Xe extends N {
|
|
|
839
839
|
this.container = e, this.initialize();
|
|
840
840
|
}
|
|
841
841
|
}
|
|
842
|
-
const
|
|
842
|
+
const Le = u(({ index: t, click: e, state: s }, n) => S({
|
|
843
843
|
class: "p-2 cursor-pointer hover:bg-muted/50",
|
|
844
844
|
onState: [
|
|
845
845
|
[s, "selectedIndex", {
|
|
@@ -848,11 +848,11 @@ const ye = d(({ index: t, click: e, state: s }, n) => v({
|
|
|
848
848
|
}]
|
|
849
849
|
],
|
|
850
850
|
pointerdown: () => e(t)
|
|
851
|
-
}, n)),
|
|
851
|
+
}, n)), Ce = u(({ selectOption: t, state: e }) => x({
|
|
852
852
|
class: "border rounded-md list-none m-0 p-0 max-h-[400px] overflow-y-auto",
|
|
853
|
-
for: ["filteredOptions", (s, n) =>
|
|
854
|
-
})),
|
|
855
|
-
|
|
853
|
+
for: ["filteredOptions", (s, n) => Le({ index: n, click: t, state: e }, s.label)]
|
|
854
|
+
})), Be = 100, Ie = u((t) => o({ class: "relative flex items-center" }, [
|
|
855
|
+
J({
|
|
856
856
|
cache: "input",
|
|
857
857
|
placeholder: t.placeholder ?? "Search...",
|
|
858
858
|
bind: [t.state, "searchQuery"],
|
|
@@ -860,26 +860,26 @@ const ye = d(({ index: t, click: e, state: s }, n) => v({
|
|
|
860
860
|
s.state.open = !0, typeof t.filterOptions == "function" && t.filterOptions(), s.dropdown.updatePosition();
|
|
861
861
|
},
|
|
862
862
|
pointerup: (e, s) => s.toggleDropdown(),
|
|
863
|
-
blur: (e, { state: s }) => setTimeout(() => s.open = !1,
|
|
863
|
+
blur: (e, { state: s }) => setTimeout(() => s.open = !1, Be),
|
|
864
864
|
keydown: (e) => typeof t.handleKeyDown == "function" && t.handleKeyDown(e)
|
|
865
865
|
}),
|
|
866
866
|
t.icon && o({ class: "absolute right-0 mr-2" }, [
|
|
867
|
-
|
|
867
|
+
z(t.icon)
|
|
868
868
|
])
|
|
869
|
-
])),
|
|
869
|
+
])), Te = (t) => o({
|
|
870
870
|
class: "relative flex fle-auto flex-col",
|
|
871
871
|
onState: ["open", (e, s, n) => {
|
|
872
872
|
if (e)
|
|
873
|
-
return new
|
|
873
|
+
return new te({
|
|
874
874
|
cache: "dropdown",
|
|
875
875
|
parent: n,
|
|
876
876
|
button: n.input,
|
|
877
877
|
size: "xl"
|
|
878
878
|
}, [
|
|
879
|
-
|
|
879
|
+
Ce(t)
|
|
880
880
|
]);
|
|
881
881
|
}]
|
|
882
|
-
}),
|
|
882
|
+
}), at = R(
|
|
883
883
|
{
|
|
884
884
|
/**
|
|
885
885
|
* This will set up the data object.
|
|
@@ -888,7 +888,7 @@ const ye = d(({ index: t, click: e, state: s }, n) => v({
|
|
|
888
888
|
*/
|
|
889
889
|
setData() {
|
|
890
890
|
const t = this.options || [];
|
|
891
|
-
return new
|
|
891
|
+
return new C({
|
|
892
892
|
options: t,
|
|
893
893
|
filteredOptions: t
|
|
894
894
|
});
|
|
@@ -976,7 +976,7 @@ const ye = d(({ index: t, click: e, state: s }, n) => v({
|
|
|
976
976
|
*/
|
|
977
977
|
render() {
|
|
978
978
|
return o({ class: "relative w-full max-w-md" }, [
|
|
979
|
-
|
|
979
|
+
Ie({
|
|
980
980
|
// @ts-ignore
|
|
981
981
|
state: this.state,
|
|
982
982
|
// @ts-ignore
|
|
@@ -988,7 +988,7 @@ const ye = d(({ index: t, click: e, state: s }, n) => v({
|
|
|
988
988
|
// @ts-ignore
|
|
989
989
|
handleKeyDown: this.handleKeyDown.bind(this)
|
|
990
990
|
}),
|
|
991
|
-
|
|
991
|
+
Te({
|
|
992
992
|
// @ts-ignore
|
|
993
993
|
state: this.state,
|
|
994
994
|
// @ts-ignore
|
|
@@ -999,22 +999,22 @@ const ye = d(({ index: t, click: e, state: s }, n) => v({
|
|
|
999
999
|
]);
|
|
1000
1000
|
}
|
|
1001
1001
|
}
|
|
1002
|
-
),
|
|
1002
|
+
), We = (t) => S(
|
|
1003
1003
|
{
|
|
1004
1004
|
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",
|
|
1005
1005
|
dataSet: ["selected", ["state", t.value, "active"]]
|
|
1006
1006
|
},
|
|
1007
1007
|
[
|
|
1008
|
-
|
|
1008
|
+
v({
|
|
1009
1009
|
class: "flex flex-auto justify-center items-center px-3 py-1.5",
|
|
1010
1010
|
onSet: ["selected", { selected: t.value }],
|
|
1011
1011
|
click: (e) => t.callBack(t.value)
|
|
1012
1012
|
}, t.label)
|
|
1013
1013
|
]
|
|
1014
|
-
), Oe = (t, e) => (t.callBack = e,
|
|
1015
|
-
|
|
1014
|
+
), Oe = (t, e) => (t.callBack = e, We(t)), Pe = (t) => L({ class: `tab items-center justify-center rounded-md bg-muted p-1 text-muted-foreground ${t.class}` }, [
|
|
1015
|
+
x({ class: "flex flex-auto flex-row", map: [t.options, (e) => Oe(e, t.callBack)] })
|
|
1016
1016
|
]);
|
|
1017
|
-
class
|
|
1017
|
+
class it extends g {
|
|
1018
1018
|
/**
|
|
1019
1019
|
* This will declare the props for the compiler.
|
|
1020
1020
|
*
|
|
@@ -1031,12 +1031,12 @@ class et extends u {
|
|
|
1031
1031
|
render() {
|
|
1032
1032
|
const e = this.select.bind(this);
|
|
1033
1033
|
return o({ class: "" }, [
|
|
1034
|
-
|
|
1034
|
+
Pe({
|
|
1035
1035
|
class: this.class,
|
|
1036
1036
|
options: this.options,
|
|
1037
1037
|
callBack: e
|
|
1038
1038
|
}),
|
|
1039
|
-
|
|
1039
|
+
P({
|
|
1040
1040
|
class: "tab-content",
|
|
1041
1041
|
onState: ["selected", this.updateContent.bind(this)]
|
|
1042
1042
|
})
|
|
@@ -1102,23 +1102,23 @@ class et extends u {
|
|
|
1102
1102
|
};
|
|
1103
1103
|
}
|
|
1104
1104
|
}
|
|
1105
|
-
const
|
|
1105
|
+
const Re = (t) => S(
|
|
1106
1106
|
{
|
|
1107
1107
|
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",
|
|
1108
1108
|
dataSet: ["selected", ["state", t.value, "active"]]
|
|
1109
1109
|
},
|
|
1110
1110
|
[
|
|
1111
|
-
|
|
1111
|
+
v({
|
|
1112
1112
|
class: "flex flex-auto justify-center items-center px-3 py-1.5 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
1113
1113
|
onSet: ["selected", { selected: t.value }],
|
|
1114
1114
|
click: (e) => t.callBack(t.value),
|
|
1115
1115
|
disabled: t.disabled
|
|
1116
1116
|
}, t.label)
|
|
1117
1117
|
]
|
|
1118
|
-
), Me = (t, e) => (t.callBack = e,
|
|
1119
|
-
|
|
1118
|
+
), Me = (t, e) => (t.callBack = e, Re(t)), ze = (t) => L({ class: `tab items-center justify-center rounded-md bg-muted p-1 text-muted-foreground ${t.class}` }, [
|
|
1119
|
+
x({ class: "flex flex-auto flex-row", map: [t.options, (e) => Me(e, t.callBack)] })
|
|
1120
1120
|
]);
|
|
1121
|
-
class
|
|
1121
|
+
class ot extends g {
|
|
1122
1122
|
/**
|
|
1123
1123
|
* This will declare the props for the compiler.
|
|
1124
1124
|
*
|
|
@@ -1134,7 +1134,7 @@ class tt extends u {
|
|
|
1134
1134
|
*/
|
|
1135
1135
|
render() {
|
|
1136
1136
|
const e = this.select.bind(this);
|
|
1137
|
-
return
|
|
1137
|
+
return ze({
|
|
1138
1138
|
class: this.class,
|
|
1139
1139
|
options: this.options,
|
|
1140
1140
|
callBack: e
|
|
@@ -1161,17 +1161,17 @@ class tt extends u {
|
|
|
1161
1161
|
};
|
|
1162
1162
|
}
|
|
1163
1163
|
}
|
|
1164
|
-
const
|
|
1164
|
+
const Ne = (t, e) => new RegExp(`${t}($|/|\\.).*`).test(e), $e = (t, e) => {
|
|
1165
1165
|
const s = t.getLinkPath();
|
|
1166
|
-
return t.exact ? e === s :
|
|
1167
|
-
},
|
|
1166
|
+
return t.exact ? e === s : Ne(s, e);
|
|
1167
|
+
}, Ae = ({ text: t, href: e, exact: s }) => new M({
|
|
1168
1168
|
text: t,
|
|
1169
1169
|
href: e,
|
|
1170
1170
|
exact: s,
|
|
1171
1171
|
dataSet: ["selected", ["state", !0, "active"]],
|
|
1172
1172
|
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"
|
|
1173
1173
|
});
|
|
1174
|
-
class
|
|
1174
|
+
class je extends g {
|
|
1175
1175
|
/**
|
|
1176
1176
|
* This will declare the props for the compiler.
|
|
1177
1177
|
*
|
|
@@ -1192,12 +1192,12 @@ class $e extends u {
|
|
|
1192
1192
|
* @returns {object}
|
|
1193
1193
|
*/
|
|
1194
1194
|
render() {
|
|
1195
|
-
return
|
|
1196
|
-
|
|
1195
|
+
return L({ class: `tab items-center justify-center rounded-md bg-muted p-1 text-muted-foreground ${this.class}` }, [
|
|
1196
|
+
x({
|
|
1197
1197
|
class: "flex flex-auto flex-row",
|
|
1198
1198
|
map: [this.options, (e) => this.addLink(e)],
|
|
1199
1199
|
watch: {
|
|
1200
|
-
value: ["[[path]]",
|
|
1200
|
+
value: ["[[path]]", y.data],
|
|
1201
1201
|
callBack: this.updateLinks.bind(this)
|
|
1202
1202
|
}
|
|
1203
1203
|
})
|
|
@@ -1209,7 +1209,7 @@ class $e extends u {
|
|
|
1209
1209
|
* @returns {void}
|
|
1210
1210
|
*/
|
|
1211
1211
|
afterSetup() {
|
|
1212
|
-
const e =
|
|
1212
|
+
const e = y.data.path;
|
|
1213
1213
|
this.updateLinks(e);
|
|
1214
1214
|
}
|
|
1215
1215
|
/**
|
|
@@ -1222,7 +1222,7 @@ class $e extends u {
|
|
|
1222
1222
|
let s = !1, n = this.links[0];
|
|
1223
1223
|
this.deactivateAllLinks();
|
|
1224
1224
|
for (const a of this.links)
|
|
1225
|
-
if (a.rendered !== !1 && (s =
|
|
1225
|
+
if (a.rendered !== !1 && (s = $e(a, e), s === !0)) {
|
|
1226
1226
|
this.updateLink(a, !0);
|
|
1227
1227
|
break;
|
|
1228
1228
|
}
|
|
@@ -1254,7 +1254,7 @@ class $e extends u {
|
|
|
1254
1254
|
* @returns {object}
|
|
1255
1255
|
*/
|
|
1256
1256
|
addLink({ label: e, href: s, exact: n }) {
|
|
1257
|
-
const a =
|
|
1257
|
+
const a = Ae({ text: e, href: s, exact: n });
|
|
1258
1258
|
return this.links.push(a), a;
|
|
1259
1259
|
}
|
|
1260
1260
|
/**
|
|
@@ -1266,7 +1266,7 @@ class $e extends u {
|
|
|
1266
1266
|
this.links = [];
|
|
1267
1267
|
}
|
|
1268
1268
|
}
|
|
1269
|
-
class
|
|
1269
|
+
class lt extends g {
|
|
1270
1270
|
/**
|
|
1271
1271
|
* This will declare the props for the compiler.
|
|
1272
1272
|
*
|
|
@@ -1282,11 +1282,11 @@ class st extends u {
|
|
|
1282
1282
|
*/
|
|
1283
1283
|
render() {
|
|
1284
1284
|
return o({ class: "tab-panel" }, [
|
|
1285
|
-
new
|
|
1285
|
+
new je({
|
|
1286
1286
|
class: this.class,
|
|
1287
1287
|
options: this.options
|
|
1288
1288
|
}),
|
|
1289
|
-
|
|
1289
|
+
P({
|
|
1290
1290
|
class: "tab-content",
|
|
1291
1291
|
switch: this.addGroup()
|
|
1292
1292
|
})
|
|
@@ -1312,33 +1312,347 @@ class st extends u {
|
|
|
1312
1312
|
return s;
|
|
1313
1313
|
}
|
|
1314
1314
|
}
|
|
1315
|
+
class Ue extends g {
|
|
1316
|
+
/**
|
|
1317
|
+
* Runs before rendering, sets up defaults, a timer for drawing,
|
|
1318
|
+
* and basic canvas properties.
|
|
1319
|
+
*
|
|
1320
|
+
* @returns {void}
|
|
1321
|
+
*/
|
|
1322
|
+
onCreated() {
|
|
1323
|
+
this.lineWidth = this.lineWidth || 3, this.lineColor = this.lineColor || "#000000", this.canvas = null, this.ctx = null, this.status = "stopped";
|
|
1324
|
+
const e = 1e3 / 60;
|
|
1325
|
+
this.timer = new G(e, f.bind(this, this.draw)), 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";
|
|
1326
|
+
}
|
|
1327
|
+
/**
|
|
1328
|
+
* Renders a <canvas> element.
|
|
1329
|
+
*
|
|
1330
|
+
* @returns {object} Layout definition for the canvas.
|
|
1331
|
+
*/
|
|
1332
|
+
render() {
|
|
1333
|
+
return {
|
|
1334
|
+
tag: "canvas"
|
|
1335
|
+
};
|
|
1336
|
+
}
|
|
1337
|
+
/**
|
|
1338
|
+
* Called before the component is destroyed. Stops the timer
|
|
1339
|
+
* to prevent memory leaks or ongoing animation.
|
|
1340
|
+
*
|
|
1341
|
+
* @returns {void}
|
|
1342
|
+
*/
|
|
1343
|
+
beforeDestroy() {
|
|
1344
|
+
this.stopTimer();
|
|
1345
|
+
}
|
|
1346
|
+
/**
|
|
1347
|
+
* Called after component setup. Initializes canvas context,
|
|
1348
|
+
* schedules a resize, and draws the initial content.
|
|
1349
|
+
*
|
|
1350
|
+
* @returns {void}
|
|
1351
|
+
*/
|
|
1352
|
+
afterSetup() {
|
|
1353
|
+
this.canvas = this.panel, this.ctx = this.canvas.getContext("2d"), window.setTimeout(() => {
|
|
1354
|
+
this.resize(), this.draw();
|
|
1355
|
+
}, 1);
|
|
1356
|
+
}
|
|
1357
|
+
/**
|
|
1358
|
+
* Defines the DOM events to set up for this canvas component.
|
|
1359
|
+
*
|
|
1360
|
+
* @returns {Array} An array of [eventName, element, callback] definitions.
|
|
1361
|
+
*/
|
|
1362
|
+
setupEvents() {
|
|
1363
|
+
const e = this.panel, s = f.bind(this, this.pointerPosition), n = f.bind(this, this.pointerUp), a = f.bind(this, this.pointerDown), i = f.bind(this, this.resize);
|
|
1364
|
+
return [
|
|
1365
|
+
["pointermove", e, s],
|
|
1366
|
+
["pointerup", e, n],
|
|
1367
|
+
["pointerdown", e, a],
|
|
1368
|
+
["pointerout", e, n],
|
|
1369
|
+
["resize", window, i]
|
|
1370
|
+
];
|
|
1371
|
+
}
|
|
1372
|
+
/**
|
|
1373
|
+
* Calculates and saves the current pointer position in canvas coordinates.
|
|
1374
|
+
*
|
|
1375
|
+
* @param {Event} e The event object (mouse or touch).
|
|
1376
|
+
* @returns {void}
|
|
1377
|
+
*/
|
|
1378
|
+
getEventPosition(e) {
|
|
1379
|
+
let s, n;
|
|
1380
|
+
const a = this.canvas, i = a.width / parseInt(a.style.width), l = a.getBoundingClientRect();
|
|
1381
|
+
if (e.touches && e.touches.length) {
|
|
1382
|
+
const h = e.touches[0];
|
|
1383
|
+
s = h.clientX, n = h.clientY;
|
|
1384
|
+
} else
|
|
1385
|
+
s = e.x || e.clientX, n = e.y || e.clientY;
|
|
1386
|
+
const d = parseInt((s - l.left) * i), c = parseInt((n - l.top) * i);
|
|
1387
|
+
this.mouse.x = d, this.mouse.y = c;
|
|
1388
|
+
}
|
|
1389
|
+
/**
|
|
1390
|
+
* Called when the pointer goes down on the canvas.
|
|
1391
|
+
* Begins a new path, sets the mouse status, and starts the timer.
|
|
1392
|
+
*
|
|
1393
|
+
* @param {Event} e The event object.
|
|
1394
|
+
* @returns {void}
|
|
1395
|
+
*/
|
|
1396
|
+
pointerDown(e) {
|
|
1397
|
+
e.preventDefault(), this.getEventPosition(e);
|
|
1398
|
+
const { ctx: s, mouse: n } = this;
|
|
1399
|
+
s.beginPath(), s.moveTo(n.x, n.y), n.status = "down", this.startTimer();
|
|
1400
|
+
}
|
|
1401
|
+
/**
|
|
1402
|
+
* Called when the pointer goes up or leaves the canvas area.
|
|
1403
|
+
* Closes the path and stops the drawing timer.
|
|
1404
|
+
*
|
|
1405
|
+
* @param {Event} e The event object.
|
|
1406
|
+
* @returns {void}
|
|
1407
|
+
*/
|
|
1408
|
+
pointerUp(e) {
|
|
1409
|
+
e.preventDefault(), this.ctx.closePath(), this.mouse.status = "up", this.stopTimer();
|
|
1410
|
+
}
|
|
1411
|
+
/**
|
|
1412
|
+
* Tracks pointer movement, updates position in real time.
|
|
1413
|
+
*
|
|
1414
|
+
* @param {Event} e The event object.
|
|
1415
|
+
* @returns {void}
|
|
1416
|
+
*/
|
|
1417
|
+
pointerPosition(e) {
|
|
1418
|
+
this.getEventPosition(e), this.mouse.status === "down" && e.preventDefault();
|
|
1419
|
+
}
|
|
1420
|
+
/**
|
|
1421
|
+
* Resizes the canvas, preserves existing drawing by converting
|
|
1422
|
+
* it to a data URL, then re-drawing.
|
|
1423
|
+
*
|
|
1424
|
+
* @returns {void}
|
|
1425
|
+
*/
|
|
1426
|
+
resize() {
|
|
1427
|
+
const { canvas: e, ctx: s } = this, n = e.toDataURL();
|
|
1428
|
+
if (this.scale(), this.setupBackground(s), n !== "data:,") {
|
|
1429
|
+
const a = new window.Image();
|
|
1430
|
+
f.on("load", a, function i() {
|
|
1431
|
+
s.drawImage(a, 0, 0), f.off("load", a, i);
|
|
1432
|
+
}), a.src = n;
|
|
1433
|
+
}
|
|
1434
|
+
this.draw();
|
|
1435
|
+
}
|
|
1436
|
+
/**
|
|
1437
|
+
* Returns a JPEG data URL of the current canvas content.
|
|
1438
|
+
*
|
|
1439
|
+
* @returns {string} The signature image as a data URL.
|
|
1440
|
+
*/
|
|
1441
|
+
getImage() {
|
|
1442
|
+
return this.canvas.toDataURL("image/jpeg", 0.7);
|
|
1443
|
+
}
|
|
1444
|
+
/**
|
|
1445
|
+
* (Deprecated approach) Resize the canvas to the container size
|
|
1446
|
+
* without scaling logic.
|
|
1447
|
+
*
|
|
1448
|
+
* @returns {void}
|
|
1449
|
+
*/
|
|
1450
|
+
noScaleResize() {
|
|
1451
|
+
const e = I.getSize(container);
|
|
1452
|
+
this.width = canvas.width = e.width, this.height = canvas.height = e.height;
|
|
1453
|
+
}
|
|
1454
|
+
/**
|
|
1455
|
+
* Scales the canvas to fit within its container, preserving aspect ratio
|
|
1456
|
+
* relative to this.targetSize.
|
|
1457
|
+
*
|
|
1458
|
+
* @returns {void}
|
|
1459
|
+
*/
|
|
1460
|
+
scale() {
|
|
1461
|
+
const e = this.canvas, s = this.container, n = I.getSize(s), a = this.targetSize, i = a.width, l = a.height;
|
|
1462
|
+
let d = i + "px", c = l + "px";
|
|
1463
|
+
if (this.width = e.width = i, this.height = e.height = l, n.width !== 0 && n.height !== 0) {
|
|
1464
|
+
const h = n.width, p = n.height, r = h / i, m = p / l, k = Math.min(r, m);
|
|
1465
|
+
d = i * k + "px", c = l * k + "px";
|
|
1466
|
+
}
|
|
1467
|
+
e.style.width = d, e.style.height = c;
|
|
1468
|
+
}
|
|
1469
|
+
/**
|
|
1470
|
+
* Main drawing loop. If the mouse is down, adds a line
|
|
1471
|
+
* from the last point to the current pointer position.
|
|
1472
|
+
*
|
|
1473
|
+
* @returns {void}
|
|
1474
|
+
*/
|
|
1475
|
+
draw() {
|
|
1476
|
+
this.mouse.status === "down" && this.addLine(this.ctx, this.mouse.x, this.mouse.y, this.lineColor);
|
|
1477
|
+
}
|
|
1478
|
+
/**
|
|
1479
|
+
* Draws the baseline at the bottom of the canvas.
|
|
1480
|
+
*
|
|
1481
|
+
* @param {CanvasRenderingContext2D} ctx The canvas 2D context.
|
|
1482
|
+
* @returns {void}
|
|
1483
|
+
*/
|
|
1484
|
+
drawBottomLine(e) {
|
|
1485
|
+
const s = this.canvas;
|
|
1486
|
+
e.globalAlpha = 1, e.shadowBlur = 0;
|
|
1487
|
+
const n = this.margin.x, a = this.height - this.margin.y;
|
|
1488
|
+
e.beginPath(), e.moveTo(n, a), e.lineTo(s.width - this.margin.x, a), e.lineWidth = this.baseLineWidth, e.strokeStyle = this.baseStrokeColor, e.stroke(), e.closePath();
|
|
1489
|
+
}
|
|
1490
|
+
/**
|
|
1491
|
+
* Adds a line to the current path, updating the 'signed' status.
|
|
1492
|
+
*
|
|
1493
|
+
* @param {CanvasRenderingContext2D} ctx The canvas context.
|
|
1494
|
+
* @param {number} px The x-coordinate.
|
|
1495
|
+
* @param {number} py The y-coordinate.
|
|
1496
|
+
* @param {string} color The stroke color.
|
|
1497
|
+
* @returns {void}
|
|
1498
|
+
*/
|
|
1499
|
+
addLine(e, s, n, a) {
|
|
1500
|
+
this.signed || (this.signed = !0);
|
|
1501
|
+
const i = Math.round(s), l = Math.round(n);
|
|
1502
|
+
e.lineWidth = this.lineWidth, e.strokeStyle = a, e.lineTo(i, l), e.stroke();
|
|
1503
|
+
}
|
|
1504
|
+
/**
|
|
1505
|
+
* Clears the canvas, sets signed to false, and re-initializes
|
|
1506
|
+
* the background for a fresh signature.
|
|
1507
|
+
*
|
|
1508
|
+
* @returns {void}
|
|
1509
|
+
*/
|
|
1510
|
+
reset() {
|
|
1511
|
+
this.signed = !1;
|
|
1512
|
+
const { ctx: e } = this;
|
|
1513
|
+
e.clearRect(0, 0, this.width, this.height), this.setupBackground(e);
|
|
1514
|
+
}
|
|
1515
|
+
/**
|
|
1516
|
+
* Fills the canvas background with white and draws the baseline.
|
|
1517
|
+
*
|
|
1518
|
+
* @param {CanvasRenderingContext2D} ctx The canvas context.
|
|
1519
|
+
* @returns {void}
|
|
1520
|
+
*/
|
|
1521
|
+
setupBackground(e) {
|
|
1522
|
+
e.fillStyle = "#FFFFFF", e.fillRect(0, 0, this.width, this.height), this.drawBottomLine(e);
|
|
1523
|
+
}
|
|
1524
|
+
/**
|
|
1525
|
+
* Starts the drawing timer so new lines can be added as pointer moves.
|
|
1526
|
+
*
|
|
1527
|
+
* @returns {void}
|
|
1528
|
+
*/
|
|
1529
|
+
startTimer() {
|
|
1530
|
+
this.stopTimer(), this.draw(), this.timer.start(), this.status = "started";
|
|
1531
|
+
}
|
|
1532
|
+
/**
|
|
1533
|
+
* Stops the drawing timer.
|
|
1534
|
+
*
|
|
1535
|
+
* @returns {void}
|
|
1536
|
+
*/
|
|
1537
|
+
stopTimer() {
|
|
1538
|
+
this.timer.stop(), this.status = "stopped";
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
class rt extends g {
|
|
1542
|
+
/**
|
|
1543
|
+
* Sets up default properties for the signature panel.
|
|
1544
|
+
*
|
|
1545
|
+
* @returns {void}
|
|
1546
|
+
*/
|
|
1547
|
+
setupProps() {
|
|
1548
|
+
this.data = null, this.lineColor = null, this.lineWidth = null, this.baseLineWidth = null, this.baseStrokeColor = null, this.margin = null, this.targetSize = null, this.callBackData = null, this.pointerUp = null, this.path = null, this.canvasLayer = null;
|
|
1549
|
+
}
|
|
1550
|
+
/**
|
|
1551
|
+
* This will run once the component is created, before rendering.
|
|
1552
|
+
* Sets a default line color if not provided.
|
|
1553
|
+
*
|
|
1554
|
+
* @returns {void}
|
|
1555
|
+
*/
|
|
1556
|
+
onCreated() {
|
|
1557
|
+
this.lineColor = this.lineColor || "#00aeef";
|
|
1558
|
+
}
|
|
1559
|
+
/**
|
|
1560
|
+
* Renders the main layout for the signature panel,
|
|
1561
|
+
* including a hidden input and a reset button.
|
|
1562
|
+
*
|
|
1563
|
+
* @returns {object} The layout object for the component.
|
|
1564
|
+
*/
|
|
1565
|
+
render() {
|
|
1566
|
+
return o({ class: "signature-panel" }, [
|
|
1567
|
+
Z({
|
|
1568
|
+
cache: "hiddenInput",
|
|
1569
|
+
required: !0,
|
|
1570
|
+
bind: this.path + ".data"
|
|
1571
|
+
}),
|
|
1572
|
+
o({ class: "signature-button-panel" }, [
|
|
1573
|
+
B({
|
|
1574
|
+
variant: "icon",
|
|
1575
|
+
icon: b.circleX,
|
|
1576
|
+
click: f.bind(this, this.reset)
|
|
1577
|
+
})
|
|
1578
|
+
]),
|
|
1579
|
+
new Ue({
|
|
1580
|
+
cache: "canvasLayer",
|
|
1581
|
+
margin: this.margin,
|
|
1582
|
+
targetSize: this.targetSize,
|
|
1583
|
+
lineColor: this.lineColor,
|
|
1584
|
+
lineWidth: this.lineWidth,
|
|
1585
|
+
baseLineWidth: this.baseLineWidth,
|
|
1586
|
+
baseStrokeColor: this.baseStrokeColor,
|
|
1587
|
+
pointerUpCallBack: this.pointerUp,
|
|
1588
|
+
callBackData: this.callBackData
|
|
1589
|
+
})
|
|
1590
|
+
]);
|
|
1591
|
+
}
|
|
1592
|
+
/**
|
|
1593
|
+
* Called after component setup. Resizes the signature canvas once
|
|
1594
|
+
* everything is ready.
|
|
1595
|
+
*
|
|
1596
|
+
* @returns {void}
|
|
1597
|
+
*/
|
|
1598
|
+
afterSetup() {
|
|
1599
|
+
this.canvasLayer.resize();
|
|
1600
|
+
}
|
|
1601
|
+
/**
|
|
1602
|
+
* Gets the signature image from the canvas layer, as a data URL.
|
|
1603
|
+
*
|
|
1604
|
+
* @returns {string} The signature image data URL.
|
|
1605
|
+
*/
|
|
1606
|
+
getImage() {
|
|
1607
|
+
return this.canvasLayer.getImage();
|
|
1608
|
+
}
|
|
1609
|
+
/**
|
|
1610
|
+
* Checks if the user has drawn anything on the signature canvas.
|
|
1611
|
+
*
|
|
1612
|
+
* @returns {boolean} True if the canvas has been signed, otherwise false.
|
|
1613
|
+
*/
|
|
1614
|
+
isSigned() {
|
|
1615
|
+
return this.canvasLayer ? this.canvasLayer.signed : !1;
|
|
1616
|
+
}
|
|
1617
|
+
/**
|
|
1618
|
+
* Resets the signature canvas to a blank state.
|
|
1619
|
+
*
|
|
1620
|
+
* @param {Event} [e] The event object (if called by a click event).
|
|
1621
|
+
* @returns {void}
|
|
1622
|
+
*/
|
|
1623
|
+
reset(e) {
|
|
1624
|
+
if (this.canvasLayer)
|
|
1625
|
+
return this.canvasLayer.reset();
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1315
1628
|
export {
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1629
|
+
tt as B,
|
|
1630
|
+
he as C,
|
|
1631
|
+
fe as D,
|
|
1632
|
+
ue as H,
|
|
1633
|
+
nt as I,
|
|
1634
|
+
et as N,
|
|
1322
1635
|
N as O,
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1636
|
+
Ke as P,
|
|
1637
|
+
at as S,
|
|
1638
|
+
ge as T,
|
|
1639
|
+
ye as U,
|
|
1640
|
+
Ve as W,
|
|
1641
|
+
ie as a,
|
|
1642
|
+
T as b,
|
|
1643
|
+
ne as c,
|
|
1644
|
+
_e as d,
|
|
1645
|
+
Ge as e,
|
|
1646
|
+
le as f,
|
|
1647
|
+
ae as g,
|
|
1648
|
+
ce as h,
|
|
1649
|
+
de as i,
|
|
1650
|
+
Je as j,
|
|
1651
|
+
Ze as k,
|
|
1652
|
+
st as l,
|
|
1653
|
+
it as m,
|
|
1654
|
+
ot as n,
|
|
1655
|
+
je as o,
|
|
1656
|
+
lt as p,
|
|
1657
|
+
rt as q
|
|
1344
1658
|
};
|