@base-framework/ui 1.0.5 → 1.0.7
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/{confirmation-BqQwYCFz.js → confirmation-K-Zelv4n.js} +68 -65
- package/dist/index.es.js +2 -2
- package/dist/molecules.es.js +1 -1
- package/dist/organisms.es.js +1 -1
- package/dist/{signature-SUQkOThQ.js → signature-panel-DCDay7u0.js} +339 -339
- package/dist/types/components/molecules/combobox/combobox.d.ts +1 -1
- package/dist/types/components/organisms/navigation/main-link.d.ts +1 -0
- package/dist/types/components/organisms/navigation/nav-button-link.d.ts +1 -0
- package/dist/types/components/organisms/navigation/navigation-atoms.d.ts +1 -0
- package/dist/types/components/organisms/navigation/navigation.d.ts +1 -0
- package/dist/types/components/organisms/organisms.d.ts +1 -1
- package/dist/types/components/organisms/overlays/dockable-overlay.d.ts +1 -1
- package/dist/types/components/organisms/overlays/inline-overlay.d.ts +1 -0
- package/dist/types/components/organisms/search/search-input.d.ts +1 -0
- package/dist/types/components/organisms/signature/signature-canvas.d.ts +1 -0
- package/dist/types/components/organisms/signature/{signature.d.ts → signature-panel.d.ts} +1 -0
- package/dist/types/components/organisms/tabs/button-tab.d.ts +1 -0
- package/dist/types/components/organisms/tabs/tab-navigation.d.ts +1 -0
- package/dist/types/components/organisms/tabs/tab.d.ts +1 -0
- package/dist/types/components/pages/basic-page.d.ts +1 -0
- package/dist/types/components/pages/blank-page.d.ts +1 -0
- package/dist/types/components/pages/center-page.d.ts +1 -0
- package/dist/types/components/pages/full-contain-page.d.ts +1 -0
- package/dist/types/components/pages/full-page.d.ts +1 -0
- package/dist/types/components/pages/fullscreen-page.d.ts +1 -0
- package/dist/types/components/pages/main-section.d.ts +1 -0
- package/dist/types/components/pages/page.d.ts +1 -0
- package/dist/types/components/pages/sidebar-menu-page.d.ts +4 -3
- package/dist/types/components/pages/templates/aside-template.d.ts +1 -0
- package/dist/types/components/pages/templates/bside-template.d.ts +1 -0
- package/dist/types/components/pages/templates/full-template.d.ts +1 -0
- package/dist/types/components/pages/templates/row.d.ts +1 -0
- package/dist/types/components/pages/templates/template-atoms.d.ts +1 -0
- package/dist/types/components/pages/templates/template.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { Button as v, Div as o, On as U, Span as y, Th as
|
|
1
|
+
import { Button as v, Div as o, On as U, Span as y, Th as P, UseParent as Y, I as E, Thead as F, Tr as H, Table as Q, P as m, Li as D, Time as X, Nav as S, Ul as b, Section as O } from "@base-framework/atoms";
|
|
2
2
|
import { Atom as u, Component as g, Data as L, DateTime as q, Jot as R, router as k, NavLink as M, base as B, Dom as I } from "@base-framework/base";
|
|
3
3
|
import { B as C, I as z } from "./icon-B9QUT2NY.js";
|
|
4
4
|
import { Icons as w } from "./icons.es.js";
|
|
5
5
|
import { TableBody as K, List as _, IntervalTimer as G } from "@base-framework/organisms";
|
|
6
6
|
import { C as V, I as J, H as Z } from "./inputs-O_WkdbI3.js";
|
|
7
|
-
import { A as
|
|
8
|
-
u((
|
|
7
|
+
import { A as tt, P as et } from "./calendar-B5TK6tLi.js";
|
|
8
|
+
u((e, t) => ({
|
|
9
9
|
class: "flex items-center px-4 py-2",
|
|
10
|
-
...
|
|
11
|
-
children:
|
|
10
|
+
...e,
|
|
11
|
+
children: t
|
|
12
12
|
}));
|
|
13
|
-
u(({ value:
|
|
13
|
+
u(({ 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 Kt extends g {
|
|
20
20
|
/**
|
|
21
21
|
* This will declare the props for the compiler.
|
|
22
22
|
*
|
|
@@ -34,57 +34,57 @@ class Ke extends g {
|
|
|
34
34
|
return o({ class: this.class || "" }, this.children);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
return
|
|
37
|
+
const st = (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
|
+
}, at = (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 && !st(a) ? {
|
|
48
48
|
weekNumber: 1,
|
|
49
49
|
year: a + 1
|
|
50
50
|
} : {
|
|
51
51
|
weekNumber: i,
|
|
52
52
|
year: a
|
|
53
53
|
};
|
|
54
|
-
},
|
|
54
|
+
}, nt = (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
|
+
}, it = (e, t, s) => Array.from({ length: s }, (a, n) => new Date(e, t + 1, n + 1)), T = (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
|
+
}, _t = (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 d = new Date(
|
|
70
|
+
const d = new Date(e, t, l);
|
|
71
71
|
i.push(l > 0 ? d : null), (i.length === 7 || l === a) && (n.push([...i]), i = []);
|
|
72
72
|
}
|
|
73
73
|
return n;
|
|
74
|
-
},
|
|
75
|
-
const s = new Date(
|
|
74
|
+
}, Gt = (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
|
+
}, ot = (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
|
+
}, lt = ({ day: e, month: t, year: s, weekNumber: a, selectWeek: n }) => {
|
|
84
|
+
const i = ot(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,10 +92,10 @@ const se = (t) => {
|
|
|
92
92
|
`,
|
|
93
93
|
click: () => n(a, s)
|
|
94
94
|
});
|
|
95
|
-
},
|
|
96
|
-
const s = new Date(
|
|
95
|
+
}, rt = (e, t) => {
|
|
96
|
+
const s = new Date(e, t, 1).getDay(), a = new Date(e, t + 1, 0).getDate(), n = nt(e, t, s), i = Array.from({ length: a }, (r, p) => new Date(e, t, p + 1)), l = (n.length + i.length) % 7, d = l === 0 ? 0 : 7 - l, c = it(e, t, d), h = [...n, ...i, ...c], f = [];
|
|
97
97
|
for (let r = 0; r < h.length; r += 7) {
|
|
98
|
-
const p = h.slice(r, r + 7), x = p.find((j) => j) || new Date(
|
|
98
|
+
const p = h.slice(r, r + 7), x = p.find((j) => j) || new Date(e, t, 1), { weekNumber: $, year: A } = at(x);
|
|
99
99
|
f.push({
|
|
100
100
|
weekNumber: $,
|
|
101
101
|
year: A,
|
|
@@ -103,8 +103,8 @@ const se = (t) => {
|
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
105
|
return f;
|
|
106
|
-
},
|
|
107
|
-
const { year: n, month: i, currentDate: l } = a, d =
|
|
106
|
+
}, ct = ({ selectWeek: e }) => U("month", (t, s, { data: a }) => {
|
|
107
|
+
const { year: n, month: i, currentDate: l } = a, d = rt(n, i);
|
|
108
108
|
return o(
|
|
109
109
|
{ class: "grid grid-cols-8 gap-1 text-sm px-4 py-2" },
|
|
110
110
|
[
|
|
@@ -129,7 +129,7 @@ const se = (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: () =>
|
|
132
|
+
click: () => e(c, f),
|
|
133
133
|
// If you have a 'currentWeek' state, you can highlight it with 'onSet'
|
|
134
134
|
onSet: ["currentWeek", {
|
|
135
135
|
"text-primary-foreground": c,
|
|
@@ -141,14 +141,14 @@ const se = (t) => {
|
|
|
141
141
|
o(
|
|
142
142
|
{ class: "grid grid-cols-7 col-span-7 text-center" },
|
|
143
143
|
h.map(
|
|
144
|
-
(r) =>
|
|
144
|
+
(r) => lt({
|
|
145
145
|
year: (r == null ? void 0 : r.getFullYear()) || null,
|
|
146
146
|
month: (r == null ? void 0 : r.getMonth()) || null,
|
|
147
147
|
day: (r == null ? void 0 : r.getDate()) || null,
|
|
148
148
|
week: h,
|
|
149
149
|
weekNumber: c,
|
|
150
150
|
currentDate: l,
|
|
151
|
-
selectWeek:
|
|
151
|
+
selectWeek: e
|
|
152
152
|
})
|
|
153
153
|
)
|
|
154
154
|
)
|
|
@@ -156,31 +156,31 @@ const se = (t) => {
|
|
|
156
156
|
)
|
|
157
157
|
]
|
|
158
158
|
);
|
|
159
|
-
}), W = ({ label:
|
|
159
|
+
}), W = ({ label: e, click: t }) => C(
|
|
160
160
|
{
|
|
161
161
|
class: `
|
|
162
162
|
inline-flex items-center justify-center h-7 w-7 bg-transparent p-0
|
|
163
163
|
opacity-50 hover:opacity-100 text-muted-foreground absolute
|
|
164
|
-
${
|
|
164
|
+
${e === "Previous" ? "left-1" : "right-1"}
|
|
165
165
|
focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2
|
|
166
166
|
`,
|
|
167
|
-
click:
|
|
168
|
-
"aria-label": `${
|
|
167
|
+
click: t,
|
|
168
|
+
"aria-label": `${e} month`,
|
|
169
169
|
variant: "icon",
|
|
170
|
-
icon:
|
|
170
|
+
icon: e === "Previous" ? w.chevron.single.left : w.chevron.single.right
|
|
171
171
|
}
|
|
172
|
-
),
|
|
172
|
+
), dt = ({ next: e, previous: t }) => o({ class: "flex flex-auto min-h-12 text-sm font-medium relative justify-center items-center" }, [
|
|
173
173
|
y("[[monthName]] [[year]]"),
|
|
174
174
|
W({
|
|
175
175
|
label: "Previous",
|
|
176
|
-
click:
|
|
176
|
+
click: t
|
|
177
177
|
}),
|
|
178
178
|
W({
|
|
179
179
|
label: "Next",
|
|
180
|
-
click:
|
|
180
|
+
click: e
|
|
181
181
|
})
|
|
182
182
|
]);
|
|
183
|
-
class
|
|
183
|
+
class Vt extends g {
|
|
184
184
|
/**
|
|
185
185
|
* This will declare the props for the compiler.
|
|
186
186
|
*
|
|
@@ -195,7 +195,7 @@ class Ve extends g {
|
|
|
195
195
|
* @returns {Data}
|
|
196
196
|
*/
|
|
197
197
|
setData() {
|
|
198
|
-
const
|
|
198
|
+
const t = /* @__PURE__ */ new Date(), s = this.selectedWeek || this.calculateCurrentWeek(t), a = T(s, t.getFullYear());
|
|
199
199
|
return new L({
|
|
200
200
|
monthName: this.getMonthName(a.getMonth()),
|
|
201
201
|
year: a.getFullYear(),
|
|
@@ -210,8 +210,8 @@ class Ve extends g {
|
|
|
210
210
|
* @param {Date} today
|
|
211
211
|
* @returns {Date}
|
|
212
212
|
*/
|
|
213
|
-
getSelectedDate(
|
|
214
|
-
const s = this.selectedDate ? new Date(this.selectedDate) :
|
|
213
|
+
getSelectedDate(t) {
|
|
214
|
+
const s = this.selectedDate ? new Date(this.selectedDate) : t;
|
|
215
215
|
return new Date(s.getFullYear(), s.getMonth(), s.getDate());
|
|
216
216
|
}
|
|
217
217
|
/**
|
|
@@ -220,8 +220,8 @@ class Ve extends g {
|
|
|
220
220
|
* @param {Date} date
|
|
221
221
|
* @returns {number}
|
|
222
222
|
*/
|
|
223
|
-
calculateCurrentWeek(
|
|
224
|
-
const s = new Date(
|
|
223
|
+
calculateCurrentWeek(t) {
|
|
224
|
+
const s = new Date(t.valueOf()), a = (t.getDay() + 6) % 7;
|
|
225
225
|
s.setDate(s.getDate() - a + 3);
|
|
226
226
|
const n = s.valueOf();
|
|
227
227
|
return s.setMonth(0, 1), s.getDay() !== 4 && s.setMonth(0, 1 + (4 - s.getDay() + 7) % 7), 1 + Math.ceil((n - s) / 6048e5);
|
|
@@ -232,8 +232,8 @@ class Ve extends g {
|
|
|
232
232
|
* @param {number} month
|
|
233
233
|
* @returns {string}
|
|
234
234
|
*/
|
|
235
|
-
getMonthName(
|
|
236
|
-
return q.monthNames[
|
|
235
|
+
getMonthName(t) {
|
|
236
|
+
return q.monthNames[t];
|
|
237
237
|
}
|
|
238
238
|
/**
|
|
239
239
|
* Updates the calendar to show the previous month.
|
|
@@ -241,8 +241,8 @@ class Ve extends g {
|
|
|
241
241
|
* @returns {void}
|
|
242
242
|
*/
|
|
243
243
|
goToPreviousMonth() {
|
|
244
|
-
const
|
|
245
|
-
let { year: s, month: a } =
|
|
244
|
+
const t = this.data;
|
|
245
|
+
let { year: s, month: a } = t;
|
|
246
246
|
a === 0 ? (a = 11, s--) : a--, this.setDate(a, s);
|
|
247
247
|
}
|
|
248
248
|
/**
|
|
@@ -251,8 +251,8 @@ class Ve extends g {
|
|
|
251
251
|
* @returns {void}
|
|
252
252
|
*/
|
|
253
253
|
goToNextMonth() {
|
|
254
|
-
const
|
|
255
|
-
let { year: s, month: a } =
|
|
254
|
+
const t = this.data;
|
|
255
|
+
let { year: s, month: a } = t;
|
|
256
256
|
a === 11 ? (a = 0, s++) : a++, this.setDate(a, s);
|
|
257
257
|
}
|
|
258
258
|
/**
|
|
@@ -263,11 +263,11 @@ class Ve extends g {
|
|
|
263
263
|
* @param {number|null} [date=null]
|
|
264
264
|
* @returns {void}
|
|
265
265
|
*/
|
|
266
|
-
setDate(
|
|
266
|
+
setDate(t, s, a) {
|
|
267
267
|
this.data.set({
|
|
268
268
|
year: s,
|
|
269
|
-
month:
|
|
270
|
-
monthName: this.getMonthName(
|
|
269
|
+
month: t,
|
|
270
|
+
monthName: this.getMonthName(t)
|
|
271
271
|
}), a && (this.data.currentDate = a);
|
|
272
272
|
}
|
|
273
273
|
/**
|
|
@@ -276,10 +276,10 @@ class Ve extends g {
|
|
|
276
276
|
* @param {number} weekNumber
|
|
277
277
|
* @returns {void}
|
|
278
278
|
*/
|
|
279
|
-
selectWeek(
|
|
280
|
-
this.data.currentWeek =
|
|
281
|
-
const a = T(
|
|
282
|
-
this.setDate(a.getMonth(), a.getFullYear(), a.getDate()), typeof this.selectedCallBack == "function" && this.selectedCallBack(
|
|
279
|
+
selectWeek(t, s) {
|
|
280
|
+
this.data.currentWeek = t;
|
|
281
|
+
const a = T(t, s);
|
|
282
|
+
this.setDate(a.getMonth(), a.getFullYear(), a.getDate()), typeof this.selectedCallBack == "function" && this.selectedCallBack(t);
|
|
283
283
|
}
|
|
284
284
|
/**
|
|
285
285
|
* Renders the WeekCalendar component.
|
|
@@ -288,47 +288,47 @@ class Ve extends g {
|
|
|
288
288
|
*/
|
|
289
289
|
render() {
|
|
290
290
|
return o({ class: "week-calendar-container border rounded-md bg-background p-3" }, [
|
|
291
|
-
|
|
291
|
+
dt({
|
|
292
292
|
next: () => this.goToNextMonth(),
|
|
293
293
|
previous: () => this.goToPreviousMonth()
|
|
294
294
|
}),
|
|
295
|
-
|
|
296
|
-
selectWeek: (
|
|
295
|
+
ct({
|
|
296
|
+
selectWeek: (t, s) => this.selectWeek(t, s)
|
|
297
297
|
})
|
|
298
298
|
]);
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
|
-
const
|
|
302
|
-
Y((
|
|
303
|
-
]),
|
|
304
|
-
const l =
|
|
305
|
-
return
|
|
301
|
+
const ht = (e) => P({ class: `cursor-pointer py-3 px-4 text-base w-10 ${e.class || ""}` }, [
|
|
302
|
+
Y((t) => new V({ class: "mr-2", onChange: () => t.toggleAllSelectedRows() }))
|
|
303
|
+
]), ut = ({ align: e, sortable: t, key: s, label: a, sort: n, class: i }) => {
|
|
304
|
+
const l = e || "justify-start";
|
|
305
|
+
return P({
|
|
306
306
|
class: `cursor-pointer py-3 px-4 text-base ${i || ""}`,
|
|
307
|
-
click:
|
|
307
|
+
click: t && (() => n(s))
|
|
308
308
|
}, [
|
|
309
309
|
o({ class: `flex flex-auto w-full items-center ${l}` }, [
|
|
310
310
|
y(a),
|
|
311
|
-
|
|
311
|
+
t && E({ class: "ml-2", html: w.arrows.upDown })
|
|
312
312
|
])
|
|
313
313
|
]);
|
|
314
|
-
},
|
|
314
|
+
}, gt = (e) => F([
|
|
315
315
|
H({
|
|
316
316
|
class: "text-muted-foreground border-b",
|
|
317
|
-
map: [
|
|
318
|
-
align:
|
|
319
|
-
sortable:
|
|
320
|
-
key:
|
|
321
|
-
label:
|
|
322
|
-
sort:
|
|
317
|
+
map: [e.headers, (t) => t.label === "checkbox" ? ht({ toggle: e.toggle }) : ut({
|
|
318
|
+
align: t.align,
|
|
319
|
+
sortable: t.sortable,
|
|
320
|
+
key: t.key,
|
|
321
|
+
label: t.label,
|
|
322
|
+
sort: e.sort
|
|
323
323
|
})]
|
|
324
324
|
})
|
|
325
|
-
]),
|
|
325
|
+
]), ft = ({ key: e, rows: t, selectRow: s, rowItem: a }) => new K({
|
|
326
326
|
cache: "table",
|
|
327
|
-
key:
|
|
328
|
-
items:
|
|
327
|
+
key: e,
|
|
328
|
+
items: t,
|
|
329
329
|
rowItem: (n) => a(n, s),
|
|
330
330
|
class: "divide-y divide-border"
|
|
331
|
-
}),
|
|
331
|
+
}), Jt = R(
|
|
332
332
|
{
|
|
333
333
|
/**
|
|
334
334
|
* Initializes component data.
|
|
@@ -347,8 +347,8 @@ const he = (t) => O({ class: `cursor-pointer py-3 px-4 text-base w-10 ${t.class
|
|
|
347
347
|
* @returns {void}
|
|
348
348
|
*/
|
|
349
349
|
toggleAllSelectedRows() {
|
|
350
|
-
const
|
|
351
|
-
this.data.selectedRows = s, this.updateSelected(), this.updateTable(!
|
|
350
|
+
const e = this.table.getRows(), t = this.data.selectedRows.length === e.length, s = t ? [] : e;
|
|
351
|
+
this.data.selectedRows = s, this.updateSelected(), this.updateTable(!t);
|
|
352
352
|
},
|
|
353
353
|
/**
|
|
354
354
|
* This will update the selected state.
|
|
@@ -356,8 +356,8 @@ const he = (t) => O({ class: `cursor-pointer py-3 px-4 text-base w-10 ${t.class
|
|
|
356
356
|
* @returns {void}
|
|
357
357
|
*/
|
|
358
358
|
updateSelected() {
|
|
359
|
-
const
|
|
360
|
-
this.data.selected =
|
|
359
|
+
const e = this.data.get("selectedRows");
|
|
360
|
+
this.data.selected = e.length > 0;
|
|
361
361
|
},
|
|
362
362
|
/**
|
|
363
363
|
* This will get the selected rows.
|
|
@@ -374,19 +374,19 @@ const he = (t) => O({ class: `cursor-pointer py-3 px-4 text-base w-10 ${t.class
|
|
|
374
374
|
* @param {boolean} selected
|
|
375
375
|
* @returns {void}
|
|
376
376
|
*/
|
|
377
|
-
updateTable(
|
|
378
|
-
const
|
|
379
|
-
|
|
377
|
+
updateTable(e) {
|
|
378
|
+
const t = this.table.getRows();
|
|
379
|
+
t.forEach((s) => s.selected = e), this.table.setRows(t);
|
|
380
380
|
},
|
|
381
381
|
/**
|
|
382
382
|
* Handles row selection.
|
|
383
383
|
*
|
|
384
384
|
* @param {object} row
|
|
385
385
|
*/
|
|
386
|
-
selectRow(
|
|
387
|
-
const
|
|
388
|
-
|
|
389
|
-
const s = this.data.get("selectedRows"), a =
|
|
386
|
+
selectRow(e) {
|
|
387
|
+
const t = e.selected ?? !1;
|
|
388
|
+
e.selected = !t;
|
|
389
|
+
const s = this.data.get("selectedRows"), a = e.selected ? [...s, e] : s.filter((n) => n !== e);
|
|
390
390
|
this.data.selectedRows = a, this.updateSelected();
|
|
391
391
|
},
|
|
392
392
|
/**
|
|
@@ -395,18 +395,18 @@ const he = (t) => O({ class: `cursor-pointer py-3 px-4 text-base w-10 ${t.class
|
|
|
395
395
|
* @returns {object}
|
|
396
396
|
*/
|
|
397
397
|
render() {
|
|
398
|
-
const
|
|
398
|
+
const e = this.rows, t = this.border !== !1 ? "border" : "";
|
|
399
399
|
return o({ class: "w-full" }, [
|
|
400
|
-
o({ class: `w-full rounded-md ${
|
|
400
|
+
o({ class: `w-full rounded-md ${t} overflow-x-auto` }, [
|
|
401
401
|
Q({ class: "w-full" }, [
|
|
402
402
|
// @ts-ignore
|
|
403
|
-
this.headers &&
|
|
403
|
+
this.headers && gt({ headers: this.headers, sort: (s) => this.sortRows(s) }),
|
|
404
404
|
// @ts-ignore
|
|
405
405
|
this.customHeader ?? null,
|
|
406
|
-
|
|
406
|
+
ft({
|
|
407
407
|
// @ts-ignore
|
|
408
408
|
key: this.key,
|
|
409
|
-
rows:
|
|
409
|
+
rows: e,
|
|
410
410
|
// @ts-ignore
|
|
411
411
|
selectRow: this.selectRow.bind(this),
|
|
412
412
|
// @ts-ignore
|
|
@@ -423,8 +423,8 @@ const he = (t) => O({ class: `cursor-pointer py-3 px-4 text-base w-10 ${t.class
|
|
|
423
423
|
* @param {array} items
|
|
424
424
|
* @returns {void}
|
|
425
425
|
*/
|
|
426
|
-
remove(
|
|
427
|
-
this.table.remove(
|
|
426
|
+
remove(e) {
|
|
427
|
+
this.table.remove(e);
|
|
428
428
|
},
|
|
429
429
|
/**
|
|
430
430
|
* This will set the items in the list.
|
|
@@ -433,8 +433,8 @@ const he = (t) => O({ class: `cursor-pointer py-3 px-4 text-base w-10 ${t.class
|
|
|
433
433
|
* @param {array} rows
|
|
434
434
|
* @returns {void}
|
|
435
435
|
*/
|
|
436
|
-
setRows(
|
|
437
|
-
this.table.setRows(
|
|
436
|
+
setRows(e) {
|
|
437
|
+
this.table.setRows(e);
|
|
438
438
|
},
|
|
439
439
|
/**
|
|
440
440
|
* This will append items to the list.
|
|
@@ -443,8 +443,8 @@ const he = (t) => O({ class: `cursor-pointer py-3 px-4 text-base w-10 ${t.class
|
|
|
443
443
|
* @param {array|object} items
|
|
444
444
|
* @returns {void}
|
|
445
445
|
*/
|
|
446
|
-
append(
|
|
447
|
-
this.table.append(
|
|
446
|
+
append(e) {
|
|
447
|
+
this.table.append(e);
|
|
448
448
|
},
|
|
449
449
|
/**
|
|
450
450
|
* This will mingle the new items with the old items.
|
|
@@ -454,8 +454,8 @@ const he = (t) => O({ class: `cursor-pointer py-3 px-4 text-base w-10 ${t.class
|
|
|
454
454
|
* @param {boolean} withDelete
|
|
455
455
|
* @returns {void}
|
|
456
456
|
*/
|
|
457
|
-
mingle(
|
|
458
|
-
this.table.mingle(
|
|
457
|
+
mingle(e, t = !1) {
|
|
458
|
+
this.table.mingle(e, t);
|
|
459
459
|
},
|
|
460
460
|
/**
|
|
461
461
|
* This will prepend items to the list.
|
|
@@ -464,8 +464,8 @@ const he = (t) => O({ class: `cursor-pointer py-3 px-4 text-base w-10 ${t.class
|
|
|
464
464
|
* @param {array|object} items
|
|
465
465
|
* @returns {void}
|
|
466
466
|
*/
|
|
467
|
-
prepend(
|
|
468
|
-
this.table.prepend(
|
|
467
|
+
prepend(e) {
|
|
468
|
+
this.table.prepend(e);
|
|
469
469
|
},
|
|
470
470
|
/**
|
|
471
471
|
* This will remove the selected rows.
|
|
@@ -476,45 +476,45 @@ const he = (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
|
-
m({ class: "text-base font-semibold leading-6 m-0" },
|
|
481
|
-
m({ class: "truncate text-sm leading-5 text-muted-foreground m-0" },
|
|
482
|
-
])),
|
|
479
|
+
), pt = u(({ name: e, email: t }) => o({ class: "min-w-0 flex-auto" }, [
|
|
480
|
+
m({ class: "text-base font-semibold leading-6 m-0" }, e),
|
|
481
|
+
m({ class: "truncate text-sm leading-5 text-muted-foreground m-0" }, t)
|
|
482
|
+
])), mt = () => 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
486
|
m({ class: "text-xs leading-5 text-gray-500" }, "Online")
|
|
487
|
-
]),
|
|
487
|
+
]), wt = (e) => m({ class: "text-xs leading-5 text-muted-foreground" }, [
|
|
488
488
|
y("Last seen "),
|
|
489
|
-
X({ datetime:
|
|
490
|
-
]),
|
|
491
|
-
m({ class: "text-sm leading-6 m-0" },
|
|
492
|
-
|
|
493
|
-
])),
|
|
489
|
+
X({ datetime: e }, "3h ago")
|
|
490
|
+
]), bt = (e, t) => e === "online" ? mt() : wt(t), xt = u(({ role: e, lastSeen: t, status: s }) => o({ class: "hidden shrink-0 sm:flex sm:flex-col sm:items-end" }, [
|
|
491
|
+
m({ class: "text-sm leading-6 m-0" }, e),
|
|
492
|
+
bt(s, t)
|
|
493
|
+
])), kt = (e) => e.split(" ").map((s) => s[0]).join(""), vt = u((e) => D({ 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
|
+
tt({ src: e.image, alt: e.name, fallbackText: kt(e.name) }),
|
|
496
|
+
pt({ name: e.name, email: e.email })
|
|
497
497
|
]),
|
|
498
|
-
|
|
499
|
-
role:
|
|
500
|
-
lastSeen:
|
|
501
|
-
status:
|
|
498
|
+
xt({
|
|
499
|
+
role: e.role,
|
|
500
|
+
lastSeen: e.lastSeen,
|
|
501
|
+
status: e.status
|
|
502
502
|
})
|
|
503
|
-
])),
|
|
503
|
+
])), Zt = u((e) => new _({
|
|
504
504
|
cache: "list",
|
|
505
505
|
key: "name",
|
|
506
|
-
items:
|
|
506
|
+
items: e.users,
|
|
507
507
|
role: "list",
|
|
508
508
|
class: "divide-y divide-border",
|
|
509
|
-
rowItem:
|
|
510
|
-
})),
|
|
511
|
-
text:
|
|
512
|
-
href:
|
|
509
|
+
rowItem: vt
|
|
510
|
+
})), yt = (e, t) => t.includes(e), Dt = (e, t, s) => e.exact ? s === t : yt(t, s), St = ({ text: e, href: t, exact: s, hidden: a }) => new M({
|
|
511
|
+
text: e,
|
|
512
|
+
href: t,
|
|
513
513
|
exact: s,
|
|
514
514
|
dataSet: ["selected", ["state", !0, "active"]],
|
|
515
515
|
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`
|
|
516
516
|
});
|
|
517
|
-
class
|
|
517
|
+
class te extends g {
|
|
518
518
|
/**
|
|
519
519
|
* This will declare the props for the compiler.
|
|
520
520
|
*
|
|
@@ -540,7 +540,7 @@ class et extends g {
|
|
|
540
540
|
[
|
|
541
541
|
b({
|
|
542
542
|
class: "flex space-x-4",
|
|
543
|
-
map: [this.options, (
|
|
543
|
+
map: [this.options, (t) => this.addLink(t)],
|
|
544
544
|
watch: {
|
|
545
545
|
value: ["[[path]]", k.data],
|
|
546
546
|
callBack: this.updateLinks.bind(this)
|
|
@@ -555,8 +555,8 @@ class et extends g {
|
|
|
555
555
|
* @returns {void}
|
|
556
556
|
*/
|
|
557
557
|
afterSetup() {
|
|
558
|
-
const
|
|
559
|
-
this.updateLinks(
|
|
558
|
+
const t = k.data.path;
|
|
559
|
+
this.updateLinks(t);
|
|
560
560
|
}
|
|
561
561
|
/**
|
|
562
562
|
* This will update the links based on the current path.
|
|
@@ -564,13 +564,13 @@ class et extends g {
|
|
|
564
564
|
* @param {string} path
|
|
565
565
|
* @returns {void}
|
|
566
566
|
*/
|
|
567
|
-
updateLinks(
|
|
567
|
+
updateLinks(t) {
|
|
568
568
|
let s = !1;
|
|
569
569
|
this.deactivateAllLinks();
|
|
570
570
|
for (const a of this.links) {
|
|
571
571
|
if (!a.rendered)
|
|
572
572
|
continue;
|
|
573
|
-
|
|
573
|
+
Dt(a, a.getLinkPath(), t) ? (this.updateLink(a, !0), s = !0) : this.updateLink(a, !1);
|
|
574
574
|
}
|
|
575
575
|
!s && this.links[0] && this.updateLink(this.links[0], !0);
|
|
576
576
|
}
|
|
@@ -580,8 +580,8 @@ class et extends g {
|
|
|
580
580
|
* @returns {void}
|
|
581
581
|
*/
|
|
582
582
|
deactivateAllLinks() {
|
|
583
|
-
for (const
|
|
584
|
-
this.updateLink(
|
|
583
|
+
for (const t of this.links)
|
|
584
|
+
this.updateLink(t, !1);
|
|
585
585
|
}
|
|
586
586
|
/**
|
|
587
587
|
* This will update the link's active state.
|
|
@@ -590,8 +590,8 @@ class et extends g {
|
|
|
590
590
|
* @param {boolean} selected
|
|
591
591
|
* @returns {void}
|
|
592
592
|
*/
|
|
593
|
-
updateLink(
|
|
594
|
-
|
|
593
|
+
updateLink(t, s) {
|
|
594
|
+
t.update(s);
|
|
595
595
|
}
|
|
596
596
|
/**
|
|
597
597
|
* This will add a link to the navigation.
|
|
@@ -599,8 +599,8 @@ class et extends g {
|
|
|
599
599
|
* @param {object} option
|
|
600
600
|
* @returns {object}
|
|
601
601
|
*/
|
|
602
|
-
addLink({ label:
|
|
603
|
-
const i =
|
|
602
|
+
addLink({ label: t, href: s, exact: a, hidden: n }) {
|
|
603
|
+
const i = St({ text: t, href: s, exact: a, hidden: n });
|
|
604
604
|
return this.links.push(i), i;
|
|
605
605
|
}
|
|
606
606
|
/**
|
|
@@ -612,9 +612,9 @@ class et extends g {
|
|
|
612
612
|
this.links = [];
|
|
613
613
|
}
|
|
614
614
|
}
|
|
615
|
-
const
|
|
616
|
-
const
|
|
617
|
-
return o({ class: `flex-none ${
|
|
615
|
+
const ee = u((e) => {
|
|
616
|
+
const t = e.margin || "m-4 ml-0";
|
|
617
|
+
return o({ class: `flex-none ${t}` }, [
|
|
618
618
|
C({
|
|
619
619
|
variant: "icon",
|
|
620
620
|
class: "back-button",
|
|
@@ -623,7 +623,7 @@ const tt = u((t) => {
|
|
|
623
623
|
window.history.back();
|
|
624
624
|
return;
|
|
625
625
|
}
|
|
626
|
-
|
|
626
|
+
e.backUrl && app.navigate(e.backUrl);
|
|
627
627
|
}
|
|
628
628
|
}, [
|
|
629
629
|
z(w.arrows.left)
|
|
@@ -671,7 +671,7 @@ class N extends g {
|
|
|
671
671
|
* @param {object} container
|
|
672
672
|
* @returns {void}
|
|
673
673
|
*/
|
|
674
|
-
setContainer(
|
|
674
|
+
setContainer(t) {
|
|
675
675
|
this.container = app.root;
|
|
676
676
|
}
|
|
677
677
|
/**
|
|
@@ -717,7 +717,7 @@ class N extends g {
|
|
|
717
717
|
return this.children;
|
|
718
718
|
}
|
|
719
719
|
}
|
|
720
|
-
class
|
|
720
|
+
class se extends N {
|
|
721
721
|
/**
|
|
722
722
|
* This will stop presistence.
|
|
723
723
|
*
|
|
@@ -732,7 +732,7 @@ class st extends N {
|
|
|
732
732
|
* @returns {object}
|
|
733
733
|
*/
|
|
734
734
|
render() {
|
|
735
|
-
const
|
|
735
|
+
const t = this.container;
|
|
736
736
|
return o(
|
|
737
737
|
{
|
|
738
738
|
onState: [
|
|
@@ -740,7 +740,7 @@ class st extends N {
|
|
|
740
740
|
loading: !0
|
|
741
741
|
}],
|
|
742
742
|
["docked", (s, a) => {
|
|
743
|
-
s ? (a.className = this.getDockedClassName(),
|
|
743
|
+
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");
|
|
744
744
|
}]
|
|
745
745
|
]
|
|
746
746
|
},
|
|
@@ -763,8 +763,8 @@ class st extends N {
|
|
|
763
763
|
* @param {object} container
|
|
764
764
|
* @returns {void}
|
|
765
765
|
*/
|
|
766
|
-
setup(
|
|
767
|
-
this.container =
|
|
766
|
+
setup(t) {
|
|
767
|
+
this.container = t, this.initialize();
|
|
768
768
|
}
|
|
769
769
|
/**
|
|
770
770
|
* This will setup the overlay states.
|
|
@@ -820,7 +820,7 @@ class st extends N {
|
|
|
820
820
|
document.documentElement.style.overflowY = "auto";
|
|
821
821
|
}
|
|
822
822
|
}
|
|
823
|
-
class
|
|
823
|
+
class ae extends N {
|
|
824
824
|
/**
|
|
825
825
|
* This will get the overlay type.
|
|
826
826
|
*
|
|
@@ -835,51 +835,51 @@ class at extends N {
|
|
|
835
835
|
* @param {object} container
|
|
836
836
|
* @returns {void}
|
|
837
837
|
*/
|
|
838
|
-
setup(
|
|
839
|
-
this.container =
|
|
838
|
+
setup(t) {
|
|
839
|
+
this.container = t, this.initialize();
|
|
840
840
|
}
|
|
841
841
|
}
|
|
842
|
-
const
|
|
842
|
+
const Lt = u(({ index: e, click: t, state: s }, a) => D({
|
|
843
843
|
class: "p-2 cursor-pointer hover:bg-muted/50",
|
|
844
844
|
onState: [
|
|
845
845
|
[s, "selectedIndex", {
|
|
846
|
-
"bg-accent":
|
|
847
|
-
"text-white":
|
|
846
|
+
"bg-accent": e,
|
|
847
|
+
"text-white": e
|
|
848
848
|
}]
|
|
849
849
|
],
|
|
850
|
-
pointerdown: () => e
|
|
851
|
-
}, a)),
|
|
850
|
+
pointerdown: () => t(e)
|
|
851
|
+
}, a)), Ct = u(({ selectOption: e, state: t }) => b({
|
|
852
852
|
class: "border rounded-md list-none m-0 p-0 max-h-[400px] overflow-y-auto",
|
|
853
|
-
for: ["filteredOptions", (s, a) =>
|
|
854
|
-
})),
|
|
853
|
+
for: ["filteredOptions", (s, a) => Lt({ index: a, click: e, state: t }, s.label)]
|
|
854
|
+
})), Bt = 100, It = u((e) => o({ class: "relative flex items-center" }, [
|
|
855
855
|
J({
|
|
856
856
|
cache: "input",
|
|
857
|
-
placeholder:
|
|
858
|
-
bind: [
|
|
859
|
-
keyup: (
|
|
860
|
-
s.state.open = !0, typeof
|
|
857
|
+
placeholder: e.placeholder ?? "Search...",
|
|
858
|
+
bind: [e.state, "searchQuery"],
|
|
859
|
+
keyup: (t, s) => {
|
|
860
|
+
s.state.open = !0, typeof e.filterOptions == "function" && e.filterOptions(), s.dropdown.updatePosition();
|
|
861
861
|
},
|
|
862
|
-
pointerup: (
|
|
863
|
-
blur: (
|
|
864
|
-
keydown: (
|
|
862
|
+
pointerup: (t, s) => s.toggleDropdown(),
|
|
863
|
+
blur: (t, { state: s }) => setTimeout(() => s.open = !1, Bt),
|
|
864
|
+
keydown: (t) => typeof e.handleKeyDown == "function" && e.handleKeyDown(t)
|
|
865
865
|
}),
|
|
866
|
-
|
|
867
|
-
z(
|
|
866
|
+
e.icon && o({ class: "absolute right-0 mr-2" }, [
|
|
867
|
+
z(e.icon)
|
|
868
868
|
])
|
|
869
|
-
])),
|
|
869
|
+
])), Tt = (e) => o({
|
|
870
870
|
class: "relative flex fle-auto flex-col",
|
|
871
|
-
onState: ["open", (
|
|
872
|
-
if (
|
|
873
|
-
return new
|
|
871
|
+
onState: ["open", (t, s, a) => {
|
|
872
|
+
if (t)
|
|
873
|
+
return new et({
|
|
874
874
|
cache: "dropdown",
|
|
875
875
|
parent: a,
|
|
876
876
|
button: a.input,
|
|
877
877
|
size: "xl"
|
|
878
878
|
}, [
|
|
879
|
-
|
|
879
|
+
Ct(e)
|
|
880
880
|
]);
|
|
881
881
|
}]
|
|
882
|
-
}),
|
|
882
|
+
}), ne = R(
|
|
883
883
|
{
|
|
884
884
|
/**
|
|
885
885
|
* This will set up the data object.
|
|
@@ -887,10 +887,10 @@ const Le = u(({ index: t, click: e, state: s }, a) => D({
|
|
|
887
887
|
* @returns {object} - The data object.
|
|
888
888
|
*/
|
|
889
889
|
setData() {
|
|
890
|
-
const
|
|
890
|
+
const e = this.options || [];
|
|
891
891
|
return new L({
|
|
892
|
-
options:
|
|
893
|
-
filteredOptions:
|
|
892
|
+
options: e,
|
|
893
|
+
filteredOptions: e
|
|
894
894
|
});
|
|
895
895
|
},
|
|
896
896
|
/**
|
|
@@ -911,10 +911,10 @@ const Le = u(({ index: t, click: e, state: s }, a) => D({
|
|
|
911
911
|
* @returns {void}
|
|
912
912
|
*/
|
|
913
913
|
setSelectedIndexByQuery() {
|
|
914
|
-
const
|
|
915
|
-
let { searchQuery:
|
|
916
|
-
|
|
917
|
-
const s =
|
|
914
|
+
const e = this.data.filteredOptions;
|
|
915
|
+
let { searchQuery: t } = this.state;
|
|
916
|
+
t = t.toLowerCase();
|
|
917
|
+
const s = e.findIndex((a) => a.label.toLowerCase() === t);
|
|
918
918
|
s >= 0 && (this.state.selectedIndex = s);
|
|
919
919
|
},
|
|
920
920
|
/**
|
|
@@ -923,14 +923,14 @@ const Le = u(({ index: t, click: e, state: s }, a) => D({
|
|
|
923
923
|
* @returns {void}
|
|
924
924
|
*/
|
|
925
925
|
filterOptions() {
|
|
926
|
-
const
|
|
927
|
-
if (
|
|
926
|
+
const e = this.state.searchQuery.toLowerCase();
|
|
927
|
+
if (e === "" || e.length === 0) {
|
|
928
928
|
this.data.filteredOptions = this.data.options;
|
|
929
929
|
return;
|
|
930
930
|
}
|
|
931
|
-
const
|
|
932
|
-
this.data.filteredOptions =
|
|
933
|
-
(s) => s.label.toLowerCase().includes(
|
|
931
|
+
const t = this.data.get("options");
|
|
932
|
+
this.data.filteredOptions = t.filter(
|
|
933
|
+
(s) => s.label.toLowerCase().includes(e)
|
|
934
934
|
);
|
|
935
935
|
},
|
|
936
936
|
/**
|
|
@@ -939,8 +939,8 @@ const Le = u(({ index: t, click: e, state: s }, a) => D({
|
|
|
939
939
|
* @returns {object}
|
|
940
940
|
*/
|
|
941
941
|
getValue() {
|
|
942
|
-
const { selectedIndex:
|
|
943
|
-
return
|
|
942
|
+
const { selectedIndex: e } = this.state;
|
|
943
|
+
return e < 0 ? null : this.data.get(`filteredOptions[${e}]`);
|
|
944
944
|
},
|
|
945
945
|
/**
|
|
946
946
|
* This will select an option.
|
|
@@ -948,10 +948,10 @@ const Le = u(({ index: t, click: e, state: s }, a) => D({
|
|
|
948
948
|
* @param {number} index - The index of the option.
|
|
949
949
|
* @returns {void}
|
|
950
950
|
*/
|
|
951
|
-
selectOption(
|
|
952
|
-
this.state.selectedIndex =
|
|
953
|
-
const
|
|
954
|
-
this.state.searchQuery =
|
|
951
|
+
selectOption(e) {
|
|
952
|
+
this.state.selectedIndex = e;
|
|
953
|
+
const t = this.data.get(`filteredOptions[${e}]`);
|
|
954
|
+
this.state.searchQuery = t.label, this.state.open = !1, typeof this.onSelect == "function" && this.onSelect(t);
|
|
955
955
|
},
|
|
956
956
|
/**
|
|
957
957
|
* Toggles the dropdown open state.
|
|
@@ -965,9 +965,9 @@ const Le = u(({ index: t, click: e, state: s }, a) => D({
|
|
|
965
965
|
* @param {object} event - The event object.
|
|
966
966
|
* @returns {void}
|
|
967
967
|
*/
|
|
968
|
-
handleKeyDown(
|
|
969
|
-
const
|
|
970
|
-
|
|
968
|
+
handleKeyDown(e) {
|
|
969
|
+
const t = this.data.filteredOptions, { selectedIndex: s } = this.state;
|
|
970
|
+
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));
|
|
971
971
|
},
|
|
972
972
|
/**
|
|
973
973
|
* This will render the component.
|
|
@@ -976,7 +976,7 @@ const Le = u(({ index: t, click: e, state: s }, a) => D({
|
|
|
976
976
|
*/
|
|
977
977
|
render() {
|
|
978
978
|
return o({ class: "relative w-full max-w-md" }, [
|
|
979
|
-
|
|
979
|
+
It({
|
|
980
980
|
// @ts-ignore
|
|
981
981
|
state: this.state,
|
|
982
982
|
// @ts-ignore
|
|
@@ -988,7 +988,7 @@ const Le = u(({ index: t, click: e, state: s }, a) => D({
|
|
|
988
988
|
// @ts-ignore
|
|
989
989
|
handleKeyDown: this.handleKeyDown.bind(this)
|
|
990
990
|
}),
|
|
991
|
-
|
|
991
|
+
Tt({
|
|
992
992
|
// @ts-ignore
|
|
993
993
|
state: this.state,
|
|
994
994
|
// @ts-ignore
|
|
@@ -999,22 +999,22 @@ const Le = u(({ index: t, click: e, state: s }, a) => D({
|
|
|
999
999
|
]);
|
|
1000
1000
|
}
|
|
1001
1001
|
}
|
|
1002
|
-
),
|
|
1002
|
+
), Wt = (e) => D(
|
|
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
|
-
dataSet: ["selected", ["state",
|
|
1005
|
+
dataSet: ["selected", ["state", e.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
|
-
onSet: ["selected", { selected:
|
|
1011
|
-
click: (
|
|
1012
|
-
},
|
|
1010
|
+
onSet: ["selected", { selected: e.value }],
|
|
1011
|
+
click: (t) => e.callBack(e.value)
|
|
1012
|
+
}, e.label)
|
|
1013
1013
|
]
|
|
1014
|
-
),
|
|
1015
|
-
b({ class: "flex flex-auto flex-row", map: [
|
|
1014
|
+
), Pt = (e, t) => (e.callBack = t, Wt(e)), Ot = (e) => S({ class: `tab items-center justify-center rounded-md bg-muted p-1 text-muted-foreground ${e.class}` }, [
|
|
1015
|
+
b({ class: "flex flex-auto flex-row", map: [e.options, (t) => Pt(t, e.callBack)] })
|
|
1016
1016
|
]);
|
|
1017
|
-
class
|
|
1017
|
+
class ie extends g {
|
|
1018
1018
|
/**
|
|
1019
1019
|
* This will declare the props for the compiler.
|
|
1020
1020
|
*
|
|
@@ -1029,14 +1029,14 @@ class it extends g {
|
|
|
1029
1029
|
* @returns {object}
|
|
1030
1030
|
*/
|
|
1031
1031
|
render() {
|
|
1032
|
-
const
|
|
1032
|
+
const t = this.select.bind(this);
|
|
1033
1033
|
return o({ class: "" }, [
|
|
1034
|
-
|
|
1034
|
+
Ot({
|
|
1035
1035
|
class: this.class,
|
|
1036
1036
|
options: this.options,
|
|
1037
|
-
callBack:
|
|
1037
|
+
callBack: t
|
|
1038
1038
|
}),
|
|
1039
|
-
|
|
1039
|
+
O({
|
|
1040
1040
|
class: "tab-content",
|
|
1041
1041
|
onState: ["selected", this.updateContent.bind(this)]
|
|
1042
1042
|
})
|
|
@@ -1048,8 +1048,8 @@ class it extends g {
|
|
|
1048
1048
|
* @returns {*}
|
|
1049
1049
|
*/
|
|
1050
1050
|
getFirstValue() {
|
|
1051
|
-
var
|
|
1052
|
-
return (
|
|
1051
|
+
var t;
|
|
1052
|
+
return (t = this.options[0]) == null ? void 0 : t.value;
|
|
1053
1053
|
}
|
|
1054
1054
|
/**
|
|
1055
1055
|
* This will update the component.
|
|
@@ -1057,8 +1057,8 @@ class it extends g {
|
|
|
1057
1057
|
* @returns {void}
|
|
1058
1058
|
*/
|
|
1059
1059
|
update() {
|
|
1060
|
-
const
|
|
1061
|
-
this.select(null), this.select(
|
|
1060
|
+
const t = this.state.get("selected");
|
|
1061
|
+
this.select(null), this.select(t);
|
|
1062
1062
|
}
|
|
1063
1063
|
/**
|
|
1064
1064
|
* This will select a value.
|
|
@@ -1066,8 +1066,8 @@ class it extends g {
|
|
|
1066
1066
|
* @param {*} value
|
|
1067
1067
|
* @returns {void}
|
|
1068
1068
|
*/
|
|
1069
|
-
select(
|
|
1070
|
-
this.state.selected =
|
|
1069
|
+
select(t) {
|
|
1070
|
+
this.state.selected = t;
|
|
1071
1071
|
}
|
|
1072
1072
|
/**
|
|
1073
1073
|
* This will update the content.
|
|
@@ -1075,13 +1075,13 @@ class it extends g {
|
|
|
1075
1075
|
* @param {*} value
|
|
1076
1076
|
* @returns {object}
|
|
1077
1077
|
*/
|
|
1078
|
-
updateContent(
|
|
1078
|
+
updateContent(t) {
|
|
1079
1079
|
const s = this.options;
|
|
1080
1080
|
if (!s || s.length < 1)
|
|
1081
1081
|
return;
|
|
1082
1082
|
const a = s[0];
|
|
1083
1083
|
for (const n of s)
|
|
1084
|
-
if (n.value ===
|
|
1084
|
+
if (n.value === t)
|
|
1085
1085
|
return n.layout;
|
|
1086
1086
|
return a.layout;
|
|
1087
1087
|
}
|
|
@@ -1091,34 +1091,34 @@ class it extends g {
|
|
|
1091
1091
|
* @returns {object}
|
|
1092
1092
|
*/
|
|
1093
1093
|
setupStates() {
|
|
1094
|
-
const
|
|
1094
|
+
const t = this.callBack, s = typeof t;
|
|
1095
1095
|
return {
|
|
1096
1096
|
selected: {
|
|
1097
1097
|
state: this.getFirstValue(),
|
|
1098
1098
|
callBack(a) {
|
|
1099
|
-
s === "function" &&
|
|
1099
|
+
s === "function" && t(a);
|
|
1100
1100
|
}
|
|
1101
1101
|
}
|
|
1102
1102
|
};
|
|
1103
1103
|
}
|
|
1104
1104
|
}
|
|
1105
|
-
const
|
|
1105
|
+
const Rt = (e) => D(
|
|
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
|
-
dataSet: ["selected", ["state",
|
|
1108
|
+
dataSet: ["selected", ["state", e.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
|
-
onSet: ["selected", { selected:
|
|
1114
|
-
click: (
|
|
1115
|
-
disabled:
|
|
1116
|
-
},
|
|
1113
|
+
onSet: ["selected", { selected: e.value }],
|
|
1114
|
+
click: (t) => e.callBack(e.value),
|
|
1115
|
+
disabled: e.disabled
|
|
1116
|
+
}, e.label)
|
|
1117
1117
|
]
|
|
1118
|
-
),
|
|
1119
|
-
b({ class: "flex flex-auto flex-row", map: [
|
|
1118
|
+
), Mt = (e, t) => (e.callBack = t, Rt(e)), zt = (e) => S({ class: `tab items-center justify-center rounded-md bg-muted p-1 text-muted-foreground ${e.class}` }, [
|
|
1119
|
+
b({ class: "flex flex-auto flex-row", map: [e.options, (t) => Mt(t, e.callBack)] })
|
|
1120
1120
|
]);
|
|
1121
|
-
class
|
|
1121
|
+
class oe extends g {
|
|
1122
1122
|
/**
|
|
1123
1123
|
* This will declare the props for the compiler.
|
|
1124
1124
|
*
|
|
@@ -1133,11 +1133,11 @@ class ot extends g {
|
|
|
1133
1133
|
* @returns {object}
|
|
1134
1134
|
*/
|
|
1135
1135
|
render() {
|
|
1136
|
-
const
|
|
1137
|
-
return
|
|
1136
|
+
const t = this.select.bind(this);
|
|
1137
|
+
return zt({
|
|
1138
1138
|
class: this.class,
|
|
1139
1139
|
options: this.options,
|
|
1140
|
-
callBack:
|
|
1140
|
+
callBack: t
|
|
1141
1141
|
});
|
|
1142
1142
|
}
|
|
1143
1143
|
/**
|
|
@@ -1146,8 +1146,8 @@ class ot extends g {
|
|
|
1146
1146
|
* @param {*} value
|
|
1147
1147
|
* @returns {void}
|
|
1148
1148
|
*/
|
|
1149
|
-
select(
|
|
1150
|
-
this.state.selected =
|
|
1149
|
+
select(t) {
|
|
1150
|
+
this.state.selected = t, typeof this.onSelect == "function" && this.onSelect(t, this.parent);
|
|
1151
1151
|
}
|
|
1152
1152
|
/**
|
|
1153
1153
|
* This will setup the states.
|
|
@@ -1155,23 +1155,23 @@ class ot extends g {
|
|
|
1155
1155
|
* @returns {object}
|
|
1156
1156
|
*/
|
|
1157
1157
|
setupStates() {
|
|
1158
|
-
var
|
|
1158
|
+
var t;
|
|
1159
1159
|
return {
|
|
1160
|
-
selected: ((
|
|
1160
|
+
selected: ((t = this.options[0]) == null ? void 0 : t.value) || null
|
|
1161
1161
|
};
|
|
1162
1162
|
}
|
|
1163
1163
|
}
|
|
1164
|
-
const
|
|
1165
|
-
const s =
|
|
1166
|
-
return
|
|
1167
|
-
},
|
|
1168
|
-
text:
|
|
1169
|
-
href:
|
|
1164
|
+
const Nt = (e, t) => new RegExp(`${e}($|/|\\.).*`).test(t), $t = (e, t) => {
|
|
1165
|
+
const s = e.getLinkPath();
|
|
1166
|
+
return e.exact ? t === s : Nt(s, t);
|
|
1167
|
+
}, At = ({ text: e, href: t, exact: s }) => new M({
|
|
1168
|
+
text: e,
|
|
1169
|
+
href: t,
|
|
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 jt extends g {
|
|
1175
1175
|
/**
|
|
1176
1176
|
* This will declare the props for the compiler.
|
|
1177
1177
|
*
|
|
@@ -1195,7 +1195,7 @@ class je extends g {
|
|
|
1195
1195
|
return S({ class: `tab items-center justify-center rounded-md bg-muted p-1 text-muted-foreground ${this.class}` }, [
|
|
1196
1196
|
b({
|
|
1197
1197
|
class: "flex flex-auto flex-row",
|
|
1198
|
-
map: [this.options, (
|
|
1198
|
+
map: [this.options, (t) => this.addLink(t)],
|
|
1199
1199
|
watch: {
|
|
1200
1200
|
value: ["[[path]]", k.data],
|
|
1201
1201
|
callBack: this.updateLinks.bind(this)
|
|
@@ -1209,8 +1209,8 @@ class je extends g {
|
|
|
1209
1209
|
* @returns {void}
|
|
1210
1210
|
*/
|
|
1211
1211
|
afterSetup() {
|
|
1212
|
-
const
|
|
1213
|
-
this.updateLinks(
|
|
1212
|
+
const t = k.data.path;
|
|
1213
|
+
this.updateLinks(t);
|
|
1214
1214
|
}
|
|
1215
1215
|
/**
|
|
1216
1216
|
* This will update the links.
|
|
@@ -1218,11 +1218,11 @@ class je extends g {
|
|
|
1218
1218
|
* @param {string} value
|
|
1219
1219
|
* @returns {void}
|
|
1220
1220
|
*/
|
|
1221
|
-
updateLinks(
|
|
1221
|
+
updateLinks(t) {
|
|
1222
1222
|
let s = !1, a = this.links[0];
|
|
1223
1223
|
this.deactivateAllLinks();
|
|
1224
1224
|
for (const n of this.links)
|
|
1225
|
-
if (n.rendered !== !1 && (s = $
|
|
1225
|
+
if (n.rendered !== !1 && (s = $t(n, t), s === !0)) {
|
|
1226
1226
|
this.updateLink(n, !0);
|
|
1227
1227
|
break;
|
|
1228
1228
|
}
|
|
@@ -1234,8 +1234,8 @@ class je extends g {
|
|
|
1234
1234
|
* @returns {void}
|
|
1235
1235
|
*/
|
|
1236
1236
|
deactivateAllLinks() {
|
|
1237
|
-
for (const
|
|
1238
|
-
this.updateLink(
|
|
1237
|
+
for (const t of this.links)
|
|
1238
|
+
this.updateLink(t, !1);
|
|
1239
1239
|
}
|
|
1240
1240
|
/**
|
|
1241
1241
|
* This will update the link.
|
|
@@ -1244,8 +1244,8 @@ class je extends g {
|
|
|
1244
1244
|
* @param {boolean} selected
|
|
1245
1245
|
* @returns {void}
|
|
1246
1246
|
*/
|
|
1247
|
-
updateLink(
|
|
1248
|
-
|
|
1247
|
+
updateLink(t, s) {
|
|
1248
|
+
t.update(s);
|
|
1249
1249
|
}
|
|
1250
1250
|
/**
|
|
1251
1251
|
* This will add a link.
|
|
@@ -1253,8 +1253,8 @@ class je extends g {
|
|
|
1253
1253
|
* @param {object} option
|
|
1254
1254
|
* @returns {object}
|
|
1255
1255
|
*/
|
|
1256
|
-
addLink({ label:
|
|
1257
|
-
const n =
|
|
1256
|
+
addLink({ label: t, href: s, exact: a }) {
|
|
1257
|
+
const n = At({ text: t, href: s, exact: a });
|
|
1258
1258
|
return this.links.push(n), n;
|
|
1259
1259
|
}
|
|
1260
1260
|
/**
|
|
@@ -1266,7 +1266,7 @@ class je extends g {
|
|
|
1266
1266
|
this.links = [];
|
|
1267
1267
|
}
|
|
1268
1268
|
}
|
|
1269
|
-
class
|
|
1269
|
+
class le extends g {
|
|
1270
1270
|
/**
|
|
1271
1271
|
* This will declare the props for the compiler.
|
|
1272
1272
|
*
|
|
@@ -1282,11 +1282,11 @@ class lt extends g {
|
|
|
1282
1282
|
*/
|
|
1283
1283
|
render() {
|
|
1284
1284
|
return o({ class: "tab-panel" }, [
|
|
1285
|
-
new
|
|
1285
|
+
new jt({
|
|
1286
1286
|
class: this.class,
|
|
1287
1287
|
options: this.options
|
|
1288
1288
|
}),
|
|
1289
|
-
|
|
1289
|
+
O({
|
|
1290
1290
|
class: "tab-content",
|
|
1291
1291
|
switch: this.addGroup()
|
|
1292
1292
|
})
|
|
@@ -1298,21 +1298,21 @@ class lt extends g {
|
|
|
1298
1298
|
* @returns {array}
|
|
1299
1299
|
*/
|
|
1300
1300
|
addGroup() {
|
|
1301
|
-
let
|
|
1301
|
+
let t;
|
|
1302
1302
|
const s = [], a = this.options;
|
|
1303
1303
|
for (let n = 0, i = a.length; n < i; n++)
|
|
1304
|
-
|
|
1304
|
+
t = a[n], s.push(
|
|
1305
1305
|
{
|
|
1306
|
-
uri:
|
|
1307
|
-
component:
|
|
1308
|
-
title:
|
|
1306
|
+
uri: t.uri || t.href,
|
|
1307
|
+
component: t.component,
|
|
1308
|
+
title: t.title || null,
|
|
1309
1309
|
persist: !0
|
|
1310
1310
|
}
|
|
1311
1311
|
);
|
|
1312
1312
|
return s;
|
|
1313
1313
|
}
|
|
1314
1314
|
}
|
|
1315
|
-
class
|
|
1315
|
+
class Ut extends g {
|
|
1316
1316
|
/**
|
|
1317
1317
|
* Runs before rendering, sets up defaults, a timer for drawing,
|
|
1318
1318
|
* and basic canvas properties.
|
|
@@ -1321,8 +1321,8 @@ class Ue extends g {
|
|
|
1321
1321
|
*/
|
|
1322
1322
|
onCreated() {
|
|
1323
1323
|
this.lineWidth = this.lineWidth || 3, this.lineColor = this.lineColor || "#000000", this.canvas = null, this.ctx = null, this.status = "stopped";
|
|
1324
|
-
const
|
|
1325
|
-
this.timer = new G(
|
|
1324
|
+
const t = 1e3 / 60;
|
|
1325
|
+
this.timer = new G(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";
|
|
1326
1326
|
}
|
|
1327
1327
|
/**
|
|
1328
1328
|
* Renders a <canvas> element.
|
|
@@ -1360,12 +1360,12 @@ class Ue extends g {
|
|
|
1360
1360
|
* @returns {Array} An array of [eventName, element, callback] definitions.
|
|
1361
1361
|
*/
|
|
1362
1362
|
setupEvents() {
|
|
1363
|
-
const
|
|
1363
|
+
const t = this.panel, s = this.pointerPosition.bind(this), a = this.pointerUp.bind(this), n = this.pointerDown.bind(this), i = this.resize.bind(this);
|
|
1364
1364
|
return [
|
|
1365
|
-
["pointermove",
|
|
1366
|
-
["pointerup",
|
|
1367
|
-
["pointerdown",
|
|
1368
|
-
["pointerout",
|
|
1365
|
+
["pointermove", t, s],
|
|
1366
|
+
["pointerup", t, a],
|
|
1367
|
+
["pointerdown", t, n],
|
|
1368
|
+
["pointerout", t, a],
|
|
1369
1369
|
["resize", window, i]
|
|
1370
1370
|
];
|
|
1371
1371
|
}
|
|
@@ -1375,14 +1375,14 @@ class Ue extends g {
|
|
|
1375
1375
|
* @param {Event} e The event object (mouse or touch).
|
|
1376
1376
|
* @returns {void}
|
|
1377
1377
|
*/
|
|
1378
|
-
getEventPosition(
|
|
1378
|
+
getEventPosition(t) {
|
|
1379
1379
|
let s, a;
|
|
1380
1380
|
const n = this.canvas, i = n.width / parseInt(n.style.width), l = n.getBoundingClientRect();
|
|
1381
|
-
if (
|
|
1382
|
-
const h =
|
|
1381
|
+
if (t.touches && t.touches.length) {
|
|
1382
|
+
const h = t.touches[0];
|
|
1383
1383
|
s = h.clientX, a = h.clientY;
|
|
1384
1384
|
} else
|
|
1385
|
-
s =
|
|
1385
|
+
s = t.x || t.clientX, a = t.y || t.clientY;
|
|
1386
1386
|
const d = parseInt((s - l.left) * i), c = parseInt((a - l.top) * i);
|
|
1387
1387
|
this.mouse.x = d, this.mouse.y = c;
|
|
1388
1388
|
}
|
|
@@ -1393,8 +1393,8 @@ class Ue extends g {
|
|
|
1393
1393
|
* @param {Event} e The event object.
|
|
1394
1394
|
* @returns {void}
|
|
1395
1395
|
*/
|
|
1396
|
-
pointerDown(
|
|
1397
|
-
|
|
1396
|
+
pointerDown(t) {
|
|
1397
|
+
t.preventDefault(), t.stopPropagation(), this.getEventPosition(t);
|
|
1398
1398
|
const { ctx: s, mouse: a } = this;
|
|
1399
1399
|
s.beginPath(), s.moveTo(a.x, a.y), a.status = "down", this.startTimer();
|
|
1400
1400
|
}
|
|
@@ -1405,8 +1405,8 @@ class Ue extends g {
|
|
|
1405
1405
|
* @param {Event} e The event object.
|
|
1406
1406
|
* @returns {void}
|
|
1407
1407
|
*/
|
|
1408
|
-
pointerUp(
|
|
1409
|
-
|
|
1408
|
+
pointerUp(t) {
|
|
1409
|
+
t.preventDefault(), t.stopPropagation(), this.ctx.closePath(), this.mouse.status = "up", this.stopTimer();
|
|
1410
1410
|
}
|
|
1411
1411
|
/**
|
|
1412
1412
|
* Tracks pointer movement, updates position in real time.
|
|
@@ -1414,8 +1414,8 @@ class Ue extends g {
|
|
|
1414
1414
|
* @param {Event} e The event object.
|
|
1415
1415
|
* @returns {void}
|
|
1416
1416
|
*/
|
|
1417
|
-
pointerPosition(
|
|
1418
|
-
this.getEventPosition(
|
|
1417
|
+
pointerPosition(t) {
|
|
1418
|
+
this.getEventPosition(t), this.mouse.status === "down" && (t.preventDefault(), t.stopPropagation());
|
|
1419
1419
|
}
|
|
1420
1420
|
/**
|
|
1421
1421
|
* Resizes the canvas, preserves existing drawing by converting
|
|
@@ -1424,7 +1424,7 @@ class Ue extends g {
|
|
|
1424
1424
|
* @returns {void}
|
|
1425
1425
|
*/
|
|
1426
1426
|
resize() {
|
|
1427
|
-
const { canvas:
|
|
1427
|
+
const { canvas: t, ctx: s } = this, a = t.toDataURL();
|
|
1428
1428
|
if (this.scale(), this.setupBackground(s), a !== "data:,") {
|
|
1429
1429
|
const n = new window.Image();
|
|
1430
1430
|
B.on("load", n, function i() {
|
|
@@ -1448,8 +1448,8 @@ class Ue extends g {
|
|
|
1448
1448
|
* @returns {void}
|
|
1449
1449
|
*/
|
|
1450
1450
|
noScaleResize() {
|
|
1451
|
-
const
|
|
1452
|
-
this.width = canvas.width =
|
|
1451
|
+
const t = I.getSize(container);
|
|
1452
|
+
this.width = canvas.width = t.width, this.height = canvas.height = t.height;
|
|
1453
1453
|
}
|
|
1454
1454
|
/**
|
|
1455
1455
|
* Scales the canvas to fit within its container, preserving aspect ratio
|
|
@@ -1458,13 +1458,13 @@ class Ue extends g {
|
|
|
1458
1458
|
* @returns {void}
|
|
1459
1459
|
*/
|
|
1460
1460
|
scale() {
|
|
1461
|
-
const
|
|
1461
|
+
const t = this.canvas, s = this.container, a = I.getSize(s), n = this.targetSize, i = n.width, l = n.height;
|
|
1462
1462
|
let d = i + "px", c = l + "px";
|
|
1463
|
-
if (this.width =
|
|
1463
|
+
if (this.width = t.width = i, this.height = t.height = l, a.width !== 0 && a.height !== 0) {
|
|
1464
1464
|
const h = a.width, f = a.height, r = h / i, p = f / l, x = Math.min(r, p);
|
|
1465
1465
|
d = i * x + "px", c = l * x + "px";
|
|
1466
1466
|
}
|
|
1467
|
-
|
|
1467
|
+
t.style.width = d, t.style.height = c;
|
|
1468
1468
|
}
|
|
1469
1469
|
/**
|
|
1470
1470
|
* Main drawing loop. If the mouse is down, adds a line
|
|
@@ -1481,11 +1481,11 @@ class Ue extends g {
|
|
|
1481
1481
|
* @param {CanvasRenderingContext2D} ctx The canvas 2D context.
|
|
1482
1482
|
* @returns {void}
|
|
1483
1483
|
*/
|
|
1484
|
-
drawBottomLine(
|
|
1484
|
+
drawBottomLine(t) {
|
|
1485
1485
|
const s = this.canvas;
|
|
1486
|
-
|
|
1486
|
+
t.globalAlpha = 1, t.shadowBlur = 0;
|
|
1487
1487
|
const a = this.margin.x, n = this.height - this.margin.y;
|
|
1488
|
-
|
|
1488
|
+
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();
|
|
1489
1489
|
}
|
|
1490
1490
|
/**
|
|
1491
1491
|
* Adds a line to the current path, updating the 'signed' status.
|
|
@@ -1496,10 +1496,10 @@ class Ue extends g {
|
|
|
1496
1496
|
* @param {string} color The stroke color.
|
|
1497
1497
|
* @returns {void}
|
|
1498
1498
|
*/
|
|
1499
|
-
addLine(
|
|
1499
|
+
addLine(t, s, a, n) {
|
|
1500
1500
|
this.signed || (this.signed = !0);
|
|
1501
1501
|
const i = Math.round(s), l = Math.round(a);
|
|
1502
|
-
|
|
1502
|
+
t.lineWidth = this.lineWidth, t.strokeStyle = n, t.lineTo(i, l), t.stroke();
|
|
1503
1503
|
}
|
|
1504
1504
|
/**
|
|
1505
1505
|
* Clears the canvas, sets signed to false, and re-initializes
|
|
@@ -1509,8 +1509,8 @@ class Ue extends g {
|
|
|
1509
1509
|
*/
|
|
1510
1510
|
reset() {
|
|
1511
1511
|
this.signed = !1;
|
|
1512
|
-
const { ctx:
|
|
1513
|
-
|
|
1512
|
+
const { ctx: t } = this;
|
|
1513
|
+
t.clearRect(0, 0, this.width, this.height), this.setupBackground(t);
|
|
1514
1514
|
}
|
|
1515
1515
|
/**
|
|
1516
1516
|
* Fills the canvas background with white and draws the baseline.
|
|
@@ -1518,8 +1518,8 @@ class Ue extends g {
|
|
|
1518
1518
|
* @param {CanvasRenderingContext2D} ctx The canvas context.
|
|
1519
1519
|
* @returns {void}
|
|
1520
1520
|
*/
|
|
1521
|
-
setupBackground(
|
|
1522
|
-
|
|
1521
|
+
setupBackground(t) {
|
|
1522
|
+
t.fillStyle = "transparent", t.fillRect(0, 0, this.width, this.height), this.drawBottomLine(t);
|
|
1523
1523
|
}
|
|
1524
1524
|
/**
|
|
1525
1525
|
* Starts the drawing timer so new lines can be added as pointer moves.
|
|
@@ -1538,7 +1538,7 @@ class Ue extends g {
|
|
|
1538
1538
|
this.timer.stop(), this.status = "stopped";
|
|
1539
1539
|
}
|
|
1540
1540
|
}
|
|
1541
|
-
class
|
|
1541
|
+
class re extends g {
|
|
1542
1542
|
/**
|
|
1543
1543
|
* Sets up default properties for the signature panel.
|
|
1544
1544
|
*
|
|
@@ -1567,7 +1567,7 @@ class rt extends g {
|
|
|
1567
1567
|
click: this.reset.bind(this)
|
|
1568
1568
|
})
|
|
1569
1569
|
]),
|
|
1570
|
-
new
|
|
1570
|
+
new Ut({
|
|
1571
1571
|
cache: "canvasLayer",
|
|
1572
1572
|
margin: this.margin,
|
|
1573
1573
|
targetSize: this.targetSize,
|
|
@@ -1611,39 +1611,39 @@ class rt extends g {
|
|
|
1611
1611
|
* @param {Event} [e] The event object (if called by a click event).
|
|
1612
1612
|
* @returns {void}
|
|
1613
1613
|
*/
|
|
1614
|
-
reset(
|
|
1614
|
+
reset(t) {
|
|
1615
1615
|
if (this.canvasLayer)
|
|
1616
1616
|
return this.canvasLayer.reset();
|
|
1617
1617
|
}
|
|
1618
1618
|
}
|
|
1619
1619
|
export {
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1620
|
+
ee as B,
|
|
1621
|
+
ht as C,
|
|
1622
|
+
ft as D,
|
|
1623
|
+
ut as H,
|
|
1624
|
+
ae as I,
|
|
1625
|
+
te as N,
|
|
1626
1626
|
N as O,
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1627
|
+
Kt as P,
|
|
1628
|
+
ne as S,
|
|
1629
|
+
gt as T,
|
|
1630
|
+
vt as U,
|
|
1631
|
+
Vt as W,
|
|
1632
|
+
it as a,
|
|
1633
1633
|
T as b,
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1634
|
+
at as c,
|
|
1635
|
+
_t as d,
|
|
1636
|
+
Gt as e,
|
|
1637
|
+
lt as f,
|
|
1638
|
+
nt as g,
|
|
1639
|
+
ct as h,
|
|
1640
|
+
dt as i,
|
|
1641
|
+
Jt as j,
|
|
1642
|
+
Zt as k,
|
|
1643
|
+
se as l,
|
|
1644
|
+
ie as m,
|
|
1645
|
+
oe as n,
|
|
1646
|
+
jt as o,
|
|
1647
|
+
le as p,
|
|
1648
|
+
re as q
|
|
1649
1649
|
};
|