vlite3 1.0.1 → 1.0.3
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/components/AttachmentsList/AttachmentsList.vue.d.ts +1 -0
- package/components/AttachmentsList/AttachmentsList.vue.js +108 -62
- package/components/AttachmentsList/types.d.ts +5 -0
- package/components/Badge.vue.js +1 -1
- package/components/Chat/ChatBubble.vue.d.ts +5 -0
- package/components/Chat/ChatInterface.vue.d.ts +18 -2
- package/components/Chat/index.d.ts +1 -1
- package/components/Clock/Clock.vue.d.ts +33 -0
- package/components/Clock/Clock.vue.js +51 -0
- package/components/Clock/Clock.vue2.js +4 -0
- package/components/Clock/index.d.ts +1 -0
- package/components/Form/utils/form.utils.d.ts +8 -5
- package/components/Form/utils/form.utils.js +142 -169
- package/components/OTPInput/OTPInput.vue.d.ts +4 -0
- package/components/OTPInput/OTPInput.vue.js +71 -59
- package/index.d.ts +1 -0
- package/index.js +7 -5
- package/package.json +1 -1
- package/style.css +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AttachmentsListProps } from './types';
|
|
2
2
|
declare const _default: import('vue').DefineComponent<AttachmentsListProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<AttachmentsListProps> & Readonly<{}>, {
|
|
3
|
+
variant: "default" | "inline";
|
|
3
4
|
canDownload: boolean;
|
|
4
5
|
canView: boolean;
|
|
5
6
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
@@ -1,82 +1,128 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import p from "../
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { $t as
|
|
6
|
-
import { downloadFile as
|
|
7
|
-
import
|
|
8
|
-
const M = { class: "w-full" },
|
|
1
|
+
import { defineComponent as C, computed as _, openBlock as n, createElementBlock as a, Fragment as f, renderList as z, normalizeClass as l, createElementVNode as i, createVNode as m, toDisplayString as w, createBlock as y, unref as r, withCtx as g, createCommentVNode as u } from "vue";
|
|
2
|
+
import p from "../Modal.vue.js";
|
|
3
|
+
import x from "../Icon.vue.js";
|
|
4
|
+
import k from "../Button.vue.js";
|
|
5
|
+
import { $t as s } from "../../utils/i18n.js";
|
|
6
|
+
import { downloadFile as P } from "../../utils/functions.js";
|
|
7
|
+
import N from "../FilePreview/FilePreview.vue.js";
|
|
8
|
+
const M = { class: "w-full" }, V = {
|
|
9
9
|
key: 0,
|
|
10
|
-
class: "flex flex-col gap-
|
|
11
|
-
},
|
|
10
|
+
class: "flex flex-col gap-1.5"
|
|
11
|
+
}, $ = { class: "flex items-center gap-2 overflow-hidden min-w-0" }, A = { class: "flex flex-col overflow-hidden leading-tight min-w-0" }, F = ["title"], U = { class: "flex items-center gap-0.5 shrink-0" }, j = ["aria-label"], S = ["aria-label", "onClick"], E = {
|
|
12
12
|
key: 1,
|
|
13
13
|
class: "text-sm text-muted-foreground italic bg-muted/10 p-4 rounded-lg border border-dashed border-border text-center"
|
|
14
|
-
},
|
|
14
|
+
}, O = /* @__PURE__ */ C({
|
|
15
15
|
__name: "AttachmentsList",
|
|
16
16
|
props: {
|
|
17
17
|
attachments: {},
|
|
18
18
|
canView: { type: Boolean, default: !0 },
|
|
19
|
-
canDownload: { type: Boolean, default: !0 }
|
|
19
|
+
canDownload: { type: Boolean, default: !0 },
|
|
20
|
+
variant: { default: "default" }
|
|
20
21
|
},
|
|
21
|
-
setup(
|
|
22
|
-
const
|
|
23
|
-
if (!
|
|
24
|
-
const
|
|
25
|
-
return parseFloat((
|
|
26
|
-
},
|
|
27
|
-
|
|
22
|
+
setup(e) {
|
|
23
|
+
const c = e, v = _(() => c.attachments ? Array.isArray(c.attachments) ? c.attachments : [c.attachments] : []), B = (o) => {
|
|
24
|
+
if (!o) return "0 Bytes";
|
|
25
|
+
const h = 1024, t = ["Bytes", "KB", "MB", "GB"], d = Math.floor(Math.log(o) / Math.log(h));
|
|
26
|
+
return parseFloat((o / Math.pow(h, d)).toFixed(2)) + " " + t[d];
|
|
27
|
+
}, b = async (o) => {
|
|
28
|
+
o.fileUrl && await P(o.fileUrl, o.fileName || "attachment");
|
|
28
29
|
};
|
|
29
|
-
return (
|
|
30
|
-
|
|
31
|
-
(
|
|
32
|
-
key:
|
|
33
|
-
class:
|
|
30
|
+
return (o, h) => (n(), a("div", M, [
|
|
31
|
+
v.value.length > 0 ? (n(), a("div", V, [
|
|
32
|
+
(n(!0), a(f, null, z(v.value, (t, d) => (n(), a("div", {
|
|
33
|
+
key: d,
|
|
34
|
+
class: l([
|
|
35
|
+
"flex items-center justify-between gap-2 px-2.5 py-2 rounded-lg transition-colors",
|
|
36
|
+
e.variant === "inline" ? "bg-[#79797924] hover:bg-[#7979793f]" : "border border-border bg-muted/20 hover:bg-muted/40"
|
|
37
|
+
])
|
|
34
38
|
}, [
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
i("div", $, [
|
|
40
|
+
i("div", {
|
|
41
|
+
class: l(["w-7 h-7 rounded flex items-center justify-center shrink-0", e.variant === "inline" ? "bg-[#79797924] hover:bg-[#7979793f]" : "bg-primary/10"])
|
|
42
|
+
}, [
|
|
43
|
+
m(x, {
|
|
38
44
|
icon: "lucide:file-text",
|
|
39
|
-
class: "w-5 h-5"
|
|
40
|
-
})
|
|
41
|
-
]),
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
class: "text-
|
|
45
|
-
title:
|
|
46
|
-
},
|
|
47
|
-
|
|
45
|
+
class: l(["w-3.5 h-3.5", e.variant === "inline" ? "opacity-75" : "text-primary"])
|
|
46
|
+
}, null, 8, ["class"])
|
|
47
|
+
], 2),
|
|
48
|
+
i("div", A, [
|
|
49
|
+
i("span", {
|
|
50
|
+
class: l(["text-xs font-medium truncate", e.variant === "inline" ? "" : "text-foreground"]),
|
|
51
|
+
title: t.fileName
|
|
52
|
+
}, w(t.fileName || "Unnamed File"), 11, F),
|
|
53
|
+
i("span", {
|
|
54
|
+
class: l(["text-[10px]", e.variant === "inline" ? "opacity-50" : "text-muted-foreground"])
|
|
55
|
+
}, w(B(t.fileSize)), 3)
|
|
48
56
|
])
|
|
49
57
|
]),
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
i("div", U, [
|
|
59
|
+
e.variant === "inline" ? (n(), a(f, { key: 0 }, [
|
|
60
|
+
e.canView ? (n(), y(p, {
|
|
61
|
+
key: 0,
|
|
62
|
+
title: t.fileName || r(s)("common.words.preview", "Preview"),
|
|
63
|
+
"max-width": "max-w-3xl",
|
|
64
|
+
body: r(N),
|
|
65
|
+
bodyProps: { url: t.fileUrl, name: t.fileName, canDownload: e.canDownload }
|
|
66
|
+
}, {
|
|
67
|
+
trigger: g(() => [
|
|
68
|
+
i("button", {
|
|
69
|
+
type: "button",
|
|
70
|
+
class: "inline-flex items-center justify-center w-6 h-6 rounded opacity-60 hover:opacity-100 bg-transparent! transition-all",
|
|
71
|
+
"aria-label": r(s)("common.words.preview", "Preview")
|
|
72
|
+
}, [
|
|
73
|
+
m(x, {
|
|
74
|
+
icon: "lucide:eye",
|
|
75
|
+
class: "w-3.5 h-3.5"
|
|
76
|
+
})
|
|
77
|
+
], 8, j)
|
|
78
|
+
]),
|
|
79
|
+
_: 1
|
|
80
|
+
}, 8, ["title", "body", "bodyProps"])) : u("", !0),
|
|
81
|
+
e.canDownload ? (n(), a("button", {
|
|
82
|
+
key: 1,
|
|
83
|
+
type: "button",
|
|
84
|
+
class: "inline-flex items-center justify-center w-6 h-6 rounded opacity-60 hover:opacity-100 bg-transparent! transition-all",
|
|
85
|
+
"aria-label": r(s)("common.words.download", "Download"),
|
|
86
|
+
onClick: (D) => b(t)
|
|
87
|
+
}, [
|
|
88
|
+
m(x, {
|
|
89
|
+
icon: "lucide:download",
|
|
90
|
+
class: "w-3.5 h-3.5"
|
|
63
91
|
})
|
|
64
|
-
]),
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
92
|
+
], 8, S)) : u("", !0)
|
|
93
|
+
], 64)) : (n(), a(f, { key: 1 }, [
|
|
94
|
+
e.canView ? (n(), y(p, {
|
|
95
|
+
key: 0,
|
|
96
|
+
title: t.fileName || r(s)("common.words.preview", "Preview"),
|
|
97
|
+
"max-width": "max-w-3xl",
|
|
98
|
+
body: r(N),
|
|
99
|
+
bodyProps: { url: t.fileUrl, name: t.fileName, canDownload: e.canDownload }
|
|
100
|
+
}, {
|
|
101
|
+
trigger: g(() => [
|
|
102
|
+
m(k, {
|
|
103
|
+
variant: "ghost",
|
|
104
|
+
size: "xs",
|
|
105
|
+
icon: "lucide:eye",
|
|
106
|
+
class: "h-6 w-6 px-0"
|
|
107
|
+
})
|
|
108
|
+
]),
|
|
109
|
+
_: 1
|
|
110
|
+
}, 8, ["title", "body", "bodyProps"])) : u("", !0),
|
|
111
|
+
e.canDownload ? (n(), y(k, {
|
|
112
|
+
key: 1,
|
|
113
|
+
variant: "ghost",
|
|
114
|
+
size: "xs",
|
|
115
|
+
icon: "lucide:download",
|
|
116
|
+
class: "h-6 w-6 px-0",
|
|
117
|
+
onClick: (D) => b(t)
|
|
118
|
+
}, null, 8, ["onClick"])) : u("", !0)
|
|
119
|
+
], 64))
|
|
74
120
|
])
|
|
75
|
-
]))), 128))
|
|
76
|
-
])) : (
|
|
121
|
+
], 2))), 128))
|
|
122
|
+
])) : (n(), a("div", E, w(r(s)("common.words.noAttachments", "No attachments found.")), 1))
|
|
77
123
|
]));
|
|
78
124
|
}
|
|
79
125
|
});
|
|
80
126
|
export {
|
|
81
|
-
|
|
127
|
+
O as default
|
|
82
128
|
};
|
|
@@ -8,4 +8,9 @@ export interface AttachmentsListProps {
|
|
|
8
8
|
attachments?: AttachmentItem | AttachmentItem[];
|
|
9
9
|
canView?: boolean;
|
|
10
10
|
canDownload?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* 'default' - standalone card style with border/muted background
|
|
13
|
+
* 'inline' - transparent overlay style for embedding inside chat bubbles
|
|
14
|
+
*/
|
|
15
|
+
variant?: 'default' | 'inline';
|
|
11
16
|
}
|
package/components/Badge.vue.js
CHANGED
|
@@ -10,7 +10,7 @@ const p = /* @__PURE__ */ b({
|
|
|
10
10
|
setup(o) {
|
|
11
11
|
const e = o, s = a(() => {
|
|
12
12
|
const r = {
|
|
13
|
-
xs: "px-1.5 h-
|
|
13
|
+
xs: "px-1.5 h-4 text-[9px] leading-none",
|
|
14
14
|
sm: "px-2 h-6 text-xs font-medium",
|
|
15
15
|
md: "px-2.5 h-7 text-xs font-semibold",
|
|
16
16
|
lg: "px-3 h-8 text-sm font-semibold"
|
|
@@ -7,6 +7,11 @@ type __VLS_Props = {
|
|
|
7
7
|
showTimestamp: boolean;
|
|
8
8
|
allowDeleteAll?: boolean;
|
|
9
9
|
allowEditAll?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* When true, the delete button requires a second click (confirmation) before emitting the delete event.
|
|
12
|
+
* Defaults to true.
|
|
13
|
+
*/
|
|
14
|
+
confirmDelete?: boolean;
|
|
10
15
|
};
|
|
11
16
|
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
12
17
|
delete: (id: string | number) => any;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
export interface ChatAttachment {
|
|
2
|
+
fileUrl: string;
|
|
3
|
+
fileName?: string;
|
|
4
|
+
fileType?: string;
|
|
5
|
+
fileSize?: number;
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}
|
|
1
8
|
export interface ChatMessage {
|
|
2
9
|
id: string | number;
|
|
3
10
|
text: string;
|
|
@@ -6,6 +13,7 @@ export interface ChatMessage {
|
|
|
6
13
|
avatar?: string;
|
|
7
14
|
timestamp?: string | Date;
|
|
8
15
|
isEdited?: boolean;
|
|
16
|
+
attachments?: ChatAttachment[];
|
|
9
17
|
[key: string]: any;
|
|
10
18
|
}
|
|
11
19
|
type __VLS_Props = {
|
|
@@ -18,20 +26,28 @@ type __VLS_Props = {
|
|
|
18
26
|
isLoadingMore?: boolean;
|
|
19
27
|
allowDeleteAll?: boolean;
|
|
20
28
|
allowEditAll?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* When true (default), the delete button requires a second click to confirm deletion.
|
|
31
|
+
* Set to false to delete immediately on first click.
|
|
32
|
+
*/
|
|
33
|
+
confirmDelete?: boolean;
|
|
34
|
+
folderId?: string;
|
|
35
|
+
maxFileSize?: number;
|
|
21
36
|
};
|
|
22
37
|
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
23
38
|
delete: (id: string | number) => any;
|
|
24
|
-
add: (text: string) => any;
|
|
39
|
+
add: (text: string, attachments?: ChatAttachment[]) => any;
|
|
25
40
|
refetch: () => any;
|
|
26
41
|
edit: (message: ChatMessage) => any;
|
|
27
42
|
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
28
43
|
onDelete?: (id: string | number) => any;
|
|
29
|
-
onAdd?: (text: string) => any;
|
|
44
|
+
onAdd?: (text: string, attachments?: ChatAttachment[]) => any;
|
|
30
45
|
onRefetch?: () => any;
|
|
31
46
|
onEdit?: (message: ChatMessage) => any;
|
|
32
47
|
}>, {
|
|
33
48
|
placeholder: string;
|
|
34
49
|
isLoadingMore: boolean;
|
|
50
|
+
confirmDelete: boolean;
|
|
35
51
|
showAvatar: boolean;
|
|
36
52
|
showUserInfo: boolean;
|
|
37
53
|
showTimestamp: boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as ChatInterface } from './ChatInterface.vue';
|
|
2
|
-
export type { ChatMessage } from './ChatInterface.vue';
|
|
2
|
+
export type { ChatMessage, ChatAttachment } from './ChatInterface.vue';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
/** dayjs-compatible format string for the time portion. Default: 'hh:mm:ss A' */
|
|
3
|
+
timeFormat?: string;
|
|
4
|
+
/** dayjs-compatible format string for the date portion. Default: 'dddd, MMMM D, YYYY' */
|
|
5
|
+
dateFormat?: string;
|
|
6
|
+
/** Whether to render the time heading. Default: true */
|
|
7
|
+
showTime?: boolean;
|
|
8
|
+
/** Whether to render the date paragraph. Default: true */
|
|
9
|
+
showDate?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Milliseconds between each clock tick.
|
|
12
|
+
* Reactive — changing this prop will immediately restart the interval.
|
|
13
|
+
* Default: 1000
|
|
14
|
+
*/
|
|
15
|
+
tickInterval?: number;
|
|
16
|
+
/** Additional Tailwind/CSS classes applied to the time <h2> element */
|
|
17
|
+
timeClass?: string;
|
|
18
|
+
/** Additional Tailwind/CSS classes applied to the date <p> element */
|
|
19
|
+
dateClass?: string;
|
|
20
|
+
/** Additional Tailwind/CSS classes applied to the root wrapper <div> */
|
|
21
|
+
wrapperClass?: string;
|
|
22
|
+
};
|
|
23
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
24
|
+
wrapperClass: string;
|
|
25
|
+
timeFormat: string;
|
|
26
|
+
dateFormat: string;
|
|
27
|
+
showTime: boolean;
|
|
28
|
+
showDate: boolean;
|
|
29
|
+
tickInterval: number;
|
|
30
|
+
timeClass: string;
|
|
31
|
+
dateClass: string;
|
|
32
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
33
|
+
export default _default;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { defineComponent as h, ref as w, watch as x, onMounted as k, onUnmounted as C, computed as i, openBlock as r, createElementBlock as n, normalizeClass as s, toDisplayString as d, createCommentVNode as u } from "vue";
|
|
2
|
+
import c from "dayjs";
|
|
3
|
+
const D = /* @__PURE__ */ h({
|
|
4
|
+
__name: "Clock",
|
|
5
|
+
props: {
|
|
6
|
+
timeFormat: { default: "hh:mm:ss A" },
|
|
7
|
+
dateFormat: { default: "dddd, MMMM D, YYYY" },
|
|
8
|
+
showTime: { type: Boolean, default: !0 },
|
|
9
|
+
showDate: { type: Boolean, default: !0 },
|
|
10
|
+
tickInterval: { default: 1e3 },
|
|
11
|
+
timeClass: { default: "" },
|
|
12
|
+
dateClass: { default: "" },
|
|
13
|
+
wrapperClass: { default: "" }
|
|
14
|
+
},
|
|
15
|
+
setup(t) {
|
|
16
|
+
const a = t, o = w(/* @__PURE__ */ new Date());
|
|
17
|
+
let e;
|
|
18
|
+
function m(l) {
|
|
19
|
+
e !== void 0 && clearInterval(e), e = setInterval(() => {
|
|
20
|
+
o.value = /* @__PURE__ */ new Date();
|
|
21
|
+
}, l);
|
|
22
|
+
}
|
|
23
|
+
x(
|
|
24
|
+
() => a.tickInterval,
|
|
25
|
+
(l) => {
|
|
26
|
+
m(l);
|
|
27
|
+
}
|
|
28
|
+
), k(() => {
|
|
29
|
+
m(a.tickInterval);
|
|
30
|
+
}), C(() => {
|
|
31
|
+
e !== void 0 && clearInterval(e);
|
|
32
|
+
});
|
|
33
|
+
const f = i(() => c(o.value).format(a.timeFormat)), v = i(() => c(o.value).format(a.dateFormat));
|
|
34
|
+
return (l, p) => (r(), n("div", {
|
|
35
|
+
class: s(["flex flex-col items-center z-10 w-full", t.wrapperClass]),
|
|
36
|
+
style: { "will-change": "transform", contain: "layout style" }
|
|
37
|
+
}, [
|
|
38
|
+
t.showTime ? (r(), n("h2", {
|
|
39
|
+
key: 0,
|
|
40
|
+
class: s(["text-5xl md:text-6xl font-extralight text-foreground tracking-tight tabular-nums", t.timeClass])
|
|
41
|
+
}, d(f.value), 3)) : u("", !0),
|
|
42
|
+
t.showDate ? (r(), n("p", {
|
|
43
|
+
key: 1,
|
|
44
|
+
class: s(["text-fs-1 font-normal text-muted-foreground mt-2.5 tracking-wide", t.dateClass])
|
|
45
|
+
}, d(v.value), 3)) : u("", !0)
|
|
46
|
+
], 2));
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
export {
|
|
50
|
+
D as default
|
|
51
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Clock } from './Clock.vue';
|
|
@@ -54,16 +54,19 @@ export declare function deepClone<T>(obj: T): T;
|
|
|
54
54
|
export declare function getFieldKey(name: string): string;
|
|
55
55
|
/**
|
|
56
56
|
* Cleans the submit payload by extracting only schema fields,
|
|
57
|
-
*
|
|
58
|
-
* Also processes mapped output and transformation functions.
|
|
57
|
+
* stripping emitFields (e.g. GraphQL __typename) from the payload recursively,
|
|
58
|
+
* and removing ignoreFields. Also processes mapped output and transformation functions.
|
|
59
|
+
*
|
|
60
|
+
* emitFields: fields to STRIP from the payload (e.g. ['__typename']).
|
|
61
|
+
* Default is ['__typename'] — this removes GraphQL metadata from all nested objects.
|
|
59
62
|
*
|
|
60
63
|
* KEY BEHAVIOUR (fix for Prisma / Postgres sync on updates):
|
|
61
64
|
* A field is included in the payload only when:
|
|
62
65
|
* 1. It has a non-empty value — always included (create & update).
|
|
63
66
|
* 2. It is empty AND the field key already existed in the original `values`
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
+
* object — meaning the user explicitly cleared a pre-existing value during
|
|
68
|
+
* an update. In this case the canonical empty value (`[]` for multiSelect,
|
|
69
|
+
* `null` for everything else) is sent so the backend overwrites the old data.
|
|
67
70
|
*
|
|
68
71
|
* Fields that were never filled in (key absent from `values`) are silently
|
|
69
72
|
* omitted to keep create payloads lean.
|
|
@@ -1,125 +1,125 @@
|
|
|
1
|
-
function
|
|
1
|
+
function U(e) {
|
|
2
2
|
return !!e && typeof e == "object";
|
|
3
3
|
}
|
|
4
|
-
function
|
|
4
|
+
function x(e) {
|
|
5
5
|
return e ? typeof e == "object" && (typeof e.render == "function" || typeof e.setup == "function" || e.__name !== void 0 || e.name !== void 0) : !1;
|
|
6
6
|
}
|
|
7
|
-
function w(e,
|
|
8
|
-
if (typeof e.type == "function" && !
|
|
7
|
+
function w(e, n) {
|
|
8
|
+
if (typeof e.type == "function" && !x(e.type))
|
|
9
9
|
try {
|
|
10
|
-
return e.type(
|
|
11
|
-
} catch (
|
|
12
|
-
return console.error(`[vlite3/Form] Error evaluating dynamic type for field "${e.name}":`,
|
|
10
|
+
return e.type(n);
|
|
11
|
+
} catch (r) {
|
|
12
|
+
return console.error(`[vlite3/Form] Error evaluating dynamic type for field "${e.name}":`, r), "text";
|
|
13
13
|
}
|
|
14
14
|
return e.type;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
if (!
|
|
18
|
-
const
|
|
19
|
-
let
|
|
20
|
-
for (const
|
|
21
|
-
if (
|
|
22
|
-
|
|
16
|
+
function m(e, n) {
|
|
17
|
+
if (!n || !e) return;
|
|
18
|
+
const r = n.split(".");
|
|
19
|
+
let a = e;
|
|
20
|
+
for (const i of r) {
|
|
21
|
+
if (a == null) return;
|
|
22
|
+
a = a[i];
|
|
23
23
|
}
|
|
24
|
-
return
|
|
24
|
+
return a;
|
|
25
25
|
}
|
|
26
|
-
function g(e,
|
|
27
|
-
if (!
|
|
28
|
-
const
|
|
29
|
-
let
|
|
30
|
-
for (let
|
|
31
|
-
const
|
|
32
|
-
Array.isArray(
|
|
26
|
+
function g(e, n, r) {
|
|
27
|
+
if (!n) return e;
|
|
28
|
+
const a = n.split("."), i = { ...e };
|
|
29
|
+
let f = i;
|
|
30
|
+
for (let u = 0; u < a.length - 1; u++) {
|
|
31
|
+
const t = a[u];
|
|
32
|
+
Array.isArray(f[t]) ? f[t] = [...f[t]] : f[t] = f[t] ? { ...f[t] } : {}, f = f[t];
|
|
33
33
|
}
|
|
34
|
-
return
|
|
34
|
+
return f[a[a.length - 1]] = r, i;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
return !
|
|
36
|
+
function E(e, n) {
|
|
37
|
+
return !U(n) || !n.name ? e : m(e, n.name) === void 0 && n.value !== void 0 ? g(e, n.name, n.value) : e;
|
|
38
38
|
}
|
|
39
|
-
async function
|
|
40
|
-
let
|
|
41
|
-
const
|
|
42
|
-
for (const
|
|
43
|
-
if (!
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
39
|
+
async function N(e, n, r, a) {
|
|
40
|
+
let i = n ? v(n) : {};
|
|
41
|
+
const f = r || i, u = Array.isArray(e[0]) ? e.flat() : e;
|
|
42
|
+
for (const t of u) {
|
|
43
|
+
if (!t.name) continue;
|
|
44
|
+
const d = { values: i, globalValues: f, isUpdate: a };
|
|
45
|
+
if (t.when && !b(t.when, d))
|
|
46
46
|
continue;
|
|
47
|
-
const
|
|
48
|
-
let
|
|
49
|
-
if (
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
(
|
|
53
|
-
) : typeof
|
|
47
|
+
const p = t.mapFrom || t.name;
|
|
48
|
+
let o = n ? m(n, p) : void 0;
|
|
49
|
+
if (o != null) {
|
|
50
|
+
const c = t.valueKey || t.key;
|
|
51
|
+
c && (Array.isArray(o) ? o = o.map(
|
|
52
|
+
(s) => s && typeof s == "object" ? m(s, c) : s
|
|
53
|
+
) : typeof o == "object" && (o = m(o, c))), t.format && (o = await t.format(o, n || {}));
|
|
54
54
|
}
|
|
55
|
-
if (
|
|
56
|
-
if (
|
|
57
|
-
const
|
|
58
|
-
|
|
55
|
+
if (o === void 0) {
|
|
56
|
+
if (t.mapFrom && n) {
|
|
57
|
+
const c = m(n, t.name);
|
|
58
|
+
c !== void 0 && (o = c);
|
|
59
59
|
}
|
|
60
|
-
if (
|
|
61
|
-
const
|
|
62
|
-
|
|
60
|
+
if (o === void 0) {
|
|
61
|
+
const c = typeof t.value == "function" ? t.value() : t.value;
|
|
62
|
+
c !== void 0 && Object.assign(i, g(i, t.name, c));
|
|
63
63
|
} else
|
|
64
|
-
Object.assign(
|
|
64
|
+
Object.assign(i, g(i, t.name, o));
|
|
65
65
|
} else
|
|
66
|
-
Object.assign(
|
|
67
|
-
if (
|
|
68
|
-
const
|
|
69
|
-
let
|
|
70
|
-
if (Array.isArray(
|
|
71
|
-
const
|
|
72
|
-
|
|
66
|
+
Object.assign(i, g(i, t.name, o));
|
|
67
|
+
if (i = E(i, t.addonLeft), i = E(i, t.addonRight), w(t, d) === "customFields" && t.props?.schema) {
|
|
68
|
+
const c = t.props.schema;
|
|
69
|
+
let s = m(i, t.name);
|
|
70
|
+
if (Array.isArray(s) && s.length > 0) {
|
|
71
|
+
const y = await Promise.all(
|
|
72
|
+
s.map((l) => N(c, l, f, a))
|
|
73
73
|
);
|
|
74
|
-
Object.assign(
|
|
74
|
+
Object.assign(i, g(i, t.name, y));
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
return
|
|
78
|
+
return i;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
81
|
-
return e === void 0 ? !1 : typeof e == "boolean" ? e : typeof e == "function" ? e(
|
|
80
|
+
function b(e, n) {
|
|
81
|
+
return e === void 0 ? !1 : typeof e == "boolean" ? e : typeof e == "function" ? e(n) : !1;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
84
|
-
return Array.isArray(e) ? e.filter((
|
|
85
|
-
const
|
|
86
|
-
return
|
|
83
|
+
function z(e, n) {
|
|
84
|
+
return Array.isArray(e) ? e.filter((r) => r ? !n.every((i) => {
|
|
85
|
+
const f = r[i.name];
|
|
86
|
+
return f == null || f === "";
|
|
87
87
|
}) : !1) : [];
|
|
88
88
|
}
|
|
89
|
-
function
|
|
90
|
-
const
|
|
91
|
-
for (const
|
|
92
|
-
if (!
|
|
93
|
-
const
|
|
94
|
-
if (
|
|
89
|
+
function C(e, n, r, a) {
|
|
90
|
+
const i = [], f = r || n, u = Array.isArray(e[0]) ? e.flat() : e;
|
|
91
|
+
for (const t of u) {
|
|
92
|
+
if (!t.name) continue;
|
|
93
|
+
const d = { values: n, globalValues: f, isUpdate: a };
|
|
94
|
+
if (t.when && !b(t.when, d))
|
|
95
95
|
continue;
|
|
96
|
-
const
|
|
97
|
-
if (
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
name:
|
|
101
|
-
value:
|
|
102
|
-
type:
|
|
103
|
-
field:
|
|
96
|
+
const p = w(t, d);
|
|
97
|
+
if (p === "file" || p === "avatarUpload" || p === "fileUploader") {
|
|
98
|
+
const o = m(n, t.name);
|
|
99
|
+
o && i.push({
|
|
100
|
+
name: t.name,
|
|
101
|
+
value: o,
|
|
102
|
+
type: p,
|
|
103
|
+
field: t
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
|
-
if (
|
|
107
|
-
const
|
|
108
|
-
if (Array.isArray(
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
if (
|
|
106
|
+
if (p === "customFields" && t.props?.schema) {
|
|
107
|
+
const o = m(n, t.name);
|
|
108
|
+
if (Array.isArray(o)) {
|
|
109
|
+
const s = t.props.schema.filter((y) => !x(y.type));
|
|
110
|
+
s.length > 0 && o.forEach((y, l) => {
|
|
111
|
+
s.forEach((h) => {
|
|
112
|
+
const O = { values: y || {}, globalValues: f, isUpdate: a };
|
|
113
|
+
if (h.when && !b(h.when, O))
|
|
114
114
|
return;
|
|
115
|
-
const
|
|
116
|
-
if (
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
name: `${
|
|
120
|
-
value:
|
|
121
|
-
type:
|
|
122
|
-
field:
|
|
115
|
+
const V = w(h, O);
|
|
116
|
+
if (V === "file" || V === "avatarUpload" || V === "fileUploader") {
|
|
117
|
+
const A = y?.[h.name];
|
|
118
|
+
A && i.push({
|
|
119
|
+
name: `${t.name}.${l}.${h.name}`,
|
|
120
|
+
value: A,
|
|
121
|
+
type: V,
|
|
122
|
+
field: h
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
125
|
});
|
|
@@ -127,97 +127,70 @@ function j(e, t, s, u) {
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
return
|
|
130
|
+
return i;
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function v(e) {
|
|
133
133
|
if (e === null || typeof e != "object") return e;
|
|
134
134
|
if (e instanceof Date) return new Date(e.getTime());
|
|
135
135
|
if (e instanceof File) return e;
|
|
136
|
-
if (Array.isArray(e)) return e.map((
|
|
137
|
-
const
|
|
138
|
-
for (const
|
|
139
|
-
Object.prototype.hasOwnProperty.call(e,
|
|
140
|
-
return
|
|
136
|
+
if (Array.isArray(e)) return e.map((r) => v(r));
|
|
137
|
+
const n = {};
|
|
138
|
+
for (const r in e)
|
|
139
|
+
Object.prototype.hasOwnProperty.call(e, r) && (n[r] = v(e[r]));
|
|
140
|
+
return n;
|
|
141
141
|
}
|
|
142
|
-
function
|
|
143
|
-
const
|
|
144
|
-
return
|
|
142
|
+
function P(e, n) {
|
|
143
|
+
const r = w(e, n);
|
|
144
|
+
return r === "multiSelect" ? [] : r === "switch" || r === "check" ? !1 : null;
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function K(e) {
|
|
147
147
|
return !!(e == null || e === "" || Array.isArray(e) && e.length === 0);
|
|
148
148
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
149
|
+
function k(e, n) {
|
|
150
|
+
if (!(!e || typeof e != "object"))
|
|
151
|
+
if (Array.isArray(e))
|
|
152
|
+
e.forEach((r) => k(r, n));
|
|
153
|
+
else {
|
|
154
|
+
for (const r of n)
|
|
155
|
+
delete e[r];
|
|
156
|
+
for (const r in e)
|
|
157
|
+
k(e[r], n);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
async function $(e, n, r, a, i, f) {
|
|
161
|
+
const u = r === void 0 && a === void 0, t = u ? v(e) : {}, d = i || e, p = Array.isArray(n[0]) ? n.flat() : n, o = r || [], c = [];
|
|
162
|
+
for (const s of p) {
|
|
163
|
+
if (!s.name) continue;
|
|
164
|
+
const y = { values: e, globalValues: d, isUpdate: f };
|
|
165
|
+
if (s.when && !b(s.when, y))
|
|
155
166
|
continue;
|
|
156
|
-
let
|
|
157
|
-
const
|
|
158
|
-
if (
|
|
159
|
-
if (!
|
|
160
|
-
|
|
167
|
+
let l = m(e, s.name);
|
|
168
|
+
const h = s.name.split(".")[0], O = Object.prototype.hasOwnProperty.call(e, h), V = w(s, y);
|
|
169
|
+
if (K(l)) {
|
|
170
|
+
if (!O) continue;
|
|
171
|
+
l = P(s, y);
|
|
161
172
|
}
|
|
162
|
-
if (
|
|
163
|
-
const
|
|
164
|
-
|
|
173
|
+
if (l = v(l), V === "customFields" && s.props?.schema && Array.isArray(l)) {
|
|
174
|
+
const S = s.props.schema;
|
|
175
|
+
l = await Promise.all(l.map((T) => $(T, S, r, a, d, f)));
|
|
165
176
|
}
|
|
166
|
-
let
|
|
167
|
-
|
|
168
|
-
const
|
|
169
|
-
|
|
177
|
+
let A = !1;
|
|
178
|
+
s.transform && (l = await s.transform(l, e), A = !0);
|
|
179
|
+
const F = s.mapTo || s.name;
|
|
180
|
+
F !== s.name && (A = !0, u && !s.name.includes(".") && delete t[s.name]), !u || A ? Object.assign(t, g(t, F, l)) : Object.assign(t, g(t, s.name, l));
|
|
170
181
|
}
|
|
171
|
-
|
|
172
|
-
const r = (i, o) => {
|
|
173
|
-
if (!(!i || typeof i != "object") && !(!o || typeof o != "object"))
|
|
174
|
-
if (Array.isArray(i) && Array.isArray(o)) {
|
|
175
|
-
for (const a of c) {
|
|
176
|
-
const d = i.find((p) => p && typeof p == "object" && p[a] !== void 0)?.[a];
|
|
177
|
-
d !== void 0 && o.forEach((p) => {
|
|
178
|
-
p && typeof p == "object" && p[a] === void 0 && (p[a] = V(d));
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
i.forEach((a, d) => {
|
|
182
|
-
o[d] && r(a, o[d]);
|
|
183
|
-
});
|
|
184
|
-
} else {
|
|
185
|
-
for (const a of c)
|
|
186
|
-
i[a] !== void 0 && o[a] === void 0 && (o[a] = V(i[a]));
|
|
187
|
-
for (const a in o)
|
|
188
|
-
typeof o[a] == "object" && typeof i[a] == "object" && r(i[a], o[a]);
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
for (const i of c)
|
|
192
|
-
e[i] !== void 0 && n[i] === void 0 && (n[i] = V(e[i]));
|
|
193
|
-
r(e, n);
|
|
194
|
-
}
|
|
195
|
-
if (y.length > 0) {
|
|
196
|
-
const r = (i) => {
|
|
197
|
-
if (!(!i || typeof i != "object"))
|
|
198
|
-
if (Array.isArray(i))
|
|
199
|
-
i.forEach(r);
|
|
200
|
-
else {
|
|
201
|
-
for (const o of y)
|
|
202
|
-
delete i[o];
|
|
203
|
-
for (const o in i)
|
|
204
|
-
r(i[o]);
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
r(n);
|
|
208
|
-
}
|
|
209
|
-
return n;
|
|
182
|
+
return o.length > 0 && k(t, o), c.length > 0 && k(t, c), t;
|
|
210
183
|
}
|
|
211
184
|
export {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
185
|
+
$ as cleanSubmitValues,
|
|
186
|
+
C as collectFileFields,
|
|
187
|
+
v as deepClone,
|
|
188
|
+
b as evaluateConditional,
|
|
189
|
+
z as filterNullCustomFields,
|
|
190
|
+
m as getNestedValue,
|
|
191
|
+
N as initializeFormValues,
|
|
192
|
+
U as isAddonObject,
|
|
193
|
+
x as isComponent,
|
|
221
194
|
w as resolveFieldType,
|
|
222
195
|
g as setNestedValue
|
|
223
196
|
};
|
|
@@ -9,6 +9,8 @@ interface Props {
|
|
|
9
9
|
variant?: 'solid' | 'outline' | 'ghost';
|
|
10
10
|
attached?: boolean;
|
|
11
11
|
size?: 'sm' | 'md' | 'lg';
|
|
12
|
+
mask?: boolean;
|
|
13
|
+
fluid?: boolean;
|
|
12
14
|
}
|
|
13
15
|
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
14
16
|
change: (value: string) => any;
|
|
@@ -21,6 +23,7 @@ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, imp
|
|
|
21
23
|
}>, {
|
|
22
24
|
length: number;
|
|
23
25
|
type: "text" | "number";
|
|
26
|
+
mask: boolean;
|
|
24
27
|
variant: "solid" | "outline" | "ghost";
|
|
25
28
|
size: "sm" | "md" | "lg";
|
|
26
29
|
error: boolean;
|
|
@@ -29,5 +32,6 @@ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, imp
|
|
|
29
32
|
modelValue: string;
|
|
30
33
|
autofocus: boolean;
|
|
31
34
|
attached: boolean;
|
|
35
|
+
fluid: boolean;
|
|
32
36
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
33
37
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as C, ref as v, watch as M, onMounted as V, nextTick as A, computed as m, openBlock as g, createElementBlock as h, normalizeClass as y, Fragment as E, renderList as F } from "vue";
|
|
2
|
+
const K = ["value", "type", "inputmode", "disabled", "placeholder", "onInput", "onKeydown"], T = /* @__PURE__ */ C({
|
|
3
3
|
__name: "OTPInput",
|
|
4
4
|
props: {
|
|
5
5
|
length: { default: 6 },
|
|
@@ -11,29 +11,31 @@ const F = ["value", "type", "disabled", "placeholder", "onInput", "onKeydown"],
|
|
|
11
11
|
placeholder: { default: "" },
|
|
12
12
|
variant: { default: "outline" },
|
|
13
13
|
attached: { type: Boolean, default: !1 },
|
|
14
|
-
size: { default: "md" }
|
|
14
|
+
size: { default: "md" },
|
|
15
|
+
mask: { type: Boolean, default: !1 },
|
|
16
|
+
fluid: { type: Boolean, default: !1 }
|
|
15
17
|
},
|
|
16
18
|
emits: ["update:modelValue", "complete", "change"],
|
|
17
|
-
setup(
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
() =>
|
|
21
|
-
(
|
|
22
|
-
const e =
|
|
19
|
+
setup(d, { emit: b }) {
|
|
20
|
+
const t = d, p = b, s = v([]), r = v(new Array(t.length).fill(""));
|
|
21
|
+
M(
|
|
22
|
+
() => t.modelValue,
|
|
23
|
+
(l) => {
|
|
24
|
+
const e = l || "", a = e.split("").slice(0, t.length);
|
|
23
25
|
if (r.value.join("") !== e) {
|
|
24
|
-
const o = new Array(
|
|
25
|
-
|
|
26
|
+
const o = new Array(t.length).fill("");
|
|
27
|
+
a.forEach((u, i) => o[i] = u), r.value = o;
|
|
26
28
|
}
|
|
27
29
|
},
|
|
28
30
|
{ immediate: !0 }
|
|
29
31
|
);
|
|
30
32
|
const c = () => {
|
|
31
|
-
const
|
|
32
|
-
p("update:modelValue",
|
|
33
|
-
},
|
|
34
|
-
let n =
|
|
35
|
-
if (
|
|
36
|
-
r.value[e] = n, c(), e <
|
|
33
|
+
const l = r.value.join("");
|
|
34
|
+
p("update:modelValue", l), p("change", l), l.length === t.length && p("complete", l);
|
|
35
|
+
}, w = (l, e) => {
|
|
36
|
+
let n = l.target.value;
|
|
37
|
+
if (t.type === "number" && (n = n.replace(/\D/g, "")), n.length === 1) {
|
|
38
|
+
r.value[e] = n, c(), e < t.length - 1 && s.value[e + 1]?.focus();
|
|
37
39
|
return;
|
|
38
40
|
}
|
|
39
41
|
if (!n) {
|
|
@@ -41,75 +43,85 @@ const F = ["value", "type", "disabled", "placeholder", "onInput", "onKeydown"],
|
|
|
41
43
|
return;
|
|
42
44
|
}
|
|
43
45
|
if (n.length > 1) {
|
|
44
|
-
const o = n.split("").slice(0,
|
|
45
|
-
o.forEach((i,
|
|
46
|
-
e +
|
|
46
|
+
const o = n.split("").slice(0, t.length - e);
|
|
47
|
+
o.forEach((i, f) => {
|
|
48
|
+
e + f < t.length && (r.value[e + f] = i);
|
|
47
49
|
}), c();
|
|
48
|
-
const u = Math.min(e + o.length,
|
|
50
|
+
const u = Math.min(e + o.length, t.length - 1);
|
|
49
51
|
s.value[u]?.focus();
|
|
50
52
|
}
|
|
51
|
-
},
|
|
52
|
-
const
|
|
53
|
-
if (
|
|
54
|
-
r.value[e] || (
|
|
53
|
+
}, D = (l, e) => {
|
|
54
|
+
const a = l.key;
|
|
55
|
+
if (a === "Backspace") {
|
|
56
|
+
r.value[e] || (l.preventDefault(), e > 0 && (r.value[e - 1] = "", s.value[e - 1]?.focus(), c()));
|
|
55
57
|
return;
|
|
56
58
|
}
|
|
57
|
-
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
const e =
|
|
59
|
+
a === "ArrowLeft" && (l.preventDefault(), e > 0 && s.value[e - 1]?.focus()), a === "ArrowRight" && (l.preventDefault(), e < t.length - 1 && s.value[e + 1]?.focus());
|
|
60
|
+
}, k = (l) => {
|
|
61
|
+
l.preventDefault();
|
|
62
|
+
const e = l.clipboardData?.getData("text/plain");
|
|
61
63
|
if (!e) return;
|
|
62
|
-
let
|
|
63
|
-
|
|
64
|
-
const n =
|
|
65
|
-
n.forEach((i,
|
|
66
|
-
o[
|
|
64
|
+
let a = e.trim();
|
|
65
|
+
t.type === "number" && (a = a.replace(/\D/g, ""));
|
|
66
|
+
const n = a.split("").slice(0, t.length), o = [...r.value];
|
|
67
|
+
n.forEach((i, f) => {
|
|
68
|
+
o[f] = i;
|
|
67
69
|
}), r.value = o, c();
|
|
68
|
-
const u = Math.min(n.length,
|
|
70
|
+
const u = Math.min(n.length, t.length - 1);
|
|
69
71
|
s.value[u]?.focus();
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
+
}, B = (l, e) => {
|
|
73
|
+
l && (s.value[e] = l);
|
|
72
74
|
};
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
V(() => {
|
|
76
|
+
t.autofocus && A(() => {
|
|
75
77
|
s.value[0]?.focus();
|
|
76
78
|
});
|
|
77
79
|
});
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
+
const I = m(() => t.mask ? "password" : t.type === "number" ? "tel" : "text"), j = m(() => {
|
|
81
|
+
if (!t.mask)
|
|
82
|
+
return t.type === "number" ? "numeric" : void 0;
|
|
83
|
+
}), x = m(() => {
|
|
84
|
+
const l = t.attached ? "-space-x-px" : "gap-2", e = t.fluid ? "w-full" : "";
|
|
85
|
+
return ["flex items-center", l, e].filter(Boolean).join(" ");
|
|
86
|
+
}), z = (l) => {
|
|
87
|
+
const e = "text-center font-medium transition-all focus:outline-none focus:z-10 disabled:opacity-50 disabled:cursor-not-allowed placeholder:text-muted-foreground", a = t.fluid ? {
|
|
88
|
+
sm: "flex-1 min-w-0 h-8 text-sm",
|
|
89
|
+
md: "flex-1 min-w-0 h-10 text-lg",
|
|
90
|
+
lg: "flex-1 min-w-0 h-12 text-xl"
|
|
91
|
+
} : {
|
|
80
92
|
sm: "w-8 h-8 text-sm",
|
|
81
93
|
md: "w-10 h-10 text-lg",
|
|
82
94
|
lg: "w-12 h-12 text-xl"
|
|
83
95
|
}, n = {
|
|
84
96
|
solid: "bg-muted border border-transparent focus:border-primary focus:ring-2 focus:ring-primary",
|
|
85
97
|
outline: "border border-input focus:border-primary focus:ring-2 focus:ring-primary",
|
|
86
|
-
ghost: "bg-transparent border border-transparent hover:bg-accent focus:
|
|
87
|
-
}, o =
|
|
98
|
+
ghost: "bg-transparent border border-transparent hover:bg-accent focus:border-primary focus:ring-2 focus:ring-primary"
|
|
99
|
+
}, o = t.error ? "border-destructive focus:ring-destructive text-destructive" : "";
|
|
88
100
|
let u = "rounded-md";
|
|
89
|
-
return
|
|
101
|
+
return t.attached && (l === 0 ? u = "rounded-l-md rounded-r-none" : l === t.length - 1 ? u = "rounded-r-md rounded-l-none" : u = "rounded-none"), [e, a[t.size], n[t.variant], o, u].join(" ");
|
|
90
102
|
};
|
|
91
|
-
return (
|
|
92
|
-
class:
|
|
103
|
+
return (l, e) => (g(), h("div", {
|
|
104
|
+
class: y(x.value)
|
|
93
105
|
}, [
|
|
94
|
-
(g(!0),
|
|
106
|
+
(g(!0), h(E, null, F(t.length, (a, n) => (g(), h("input", {
|
|
95
107
|
key: n,
|
|
96
108
|
ref_for: !0,
|
|
97
|
-
ref: (o) =>
|
|
109
|
+
ref: (o) => B(o, n),
|
|
98
110
|
value: r.value[n],
|
|
99
|
-
type:
|
|
100
|
-
inputmode:
|
|
111
|
+
type: I.value,
|
|
112
|
+
inputmode: j.value,
|
|
101
113
|
maxlength: 1,
|
|
102
|
-
disabled:
|
|
103
|
-
placeholder:
|
|
104
|
-
class:
|
|
105
|
-
onInput: (o) =>
|
|
106
|
-
onKeydown: (o) =>
|
|
107
|
-
onPaste:
|
|
108
|
-
onFocus: e[0] || (e[0] = (o) =>
|
|
109
|
-
}, null, 42,
|
|
114
|
+
disabled: d.disabled,
|
|
115
|
+
placeholder: d.placeholder,
|
|
116
|
+
class: y(z(n)),
|
|
117
|
+
onInput: (o) => w(o, n),
|
|
118
|
+
onKeydown: (o) => D(o, n),
|
|
119
|
+
onPaste: k,
|
|
120
|
+
onFocus: e[0] || (e[0] = (o) => l.$emit("update:modelValue", r.value.join("")))
|
|
121
|
+
}, null, 42, K))), 128))
|
|
110
122
|
], 2));
|
|
111
123
|
}
|
|
112
124
|
});
|
|
113
125
|
export {
|
|
114
|
-
|
|
126
|
+
T as default
|
|
115
127
|
};
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -118,7 +118,8 @@ import { default as Qt } from "./components/StatusChip/StatusChip.vue.js";
|
|
|
118
118
|
import { STATUS_MAP as qt, normalizeStatus as Wt, resolveStatus as Xt } from "./components/StatusChip/status-map.js";
|
|
119
119
|
import { default as Jt } from "./components/Price/Price.vue.js";
|
|
120
120
|
import { default as ea } from "./components/DateTime/DateTime.vue.js";
|
|
121
|
-
import {
|
|
121
|
+
import { default as ra } from "./components/Clock/Clock.vue.js";
|
|
122
|
+
import { VLITE_CONFIG_KEY as aa, configState as fa, updateConfig as ma, useVLiteConfig as la } from "./core/config.js";
|
|
122
123
|
export {
|
|
123
124
|
E as $t,
|
|
124
125
|
Fo as Accordion,
|
|
@@ -140,6 +141,7 @@ export {
|
|
|
140
141
|
nt as CheckBox,
|
|
141
142
|
L as Chip,
|
|
142
143
|
yo as ChoiceBox,
|
|
144
|
+
ra as Clock,
|
|
143
145
|
yt as ColorPicker,
|
|
144
146
|
Ot as CommandPaletteContent,
|
|
145
147
|
Mt as ConfirmationModal,
|
|
@@ -218,12 +220,12 @@ export {
|
|
|
218
220
|
Mr as TimelineItem,
|
|
219
221
|
Rt as ToastNotification,
|
|
220
222
|
xt as Tooltip,
|
|
221
|
-
|
|
223
|
+
aa as VLITE_CONFIG_KEY,
|
|
222
224
|
fo as Workbook,
|
|
223
225
|
we as barcodesConstants,
|
|
224
226
|
p as camelCase,
|
|
225
227
|
d as capitalize,
|
|
226
|
-
|
|
228
|
+
fa as configState,
|
|
227
229
|
Fr as configure,
|
|
228
230
|
u as copyToClipboard,
|
|
229
231
|
Ht as createVLite,
|
|
@@ -259,7 +261,7 @@ export {
|
|
|
259
261
|
F as throttle,
|
|
260
262
|
Br as toast,
|
|
261
263
|
v as truncate,
|
|
262
|
-
|
|
264
|
+
ma as updateConfig,
|
|
263
265
|
Sr as useAdvancedKeyStroke,
|
|
264
266
|
Ye as useDropdownIds,
|
|
265
267
|
Ve as useDropdownSelection,
|
|
@@ -271,6 +273,6 @@ export {
|
|
|
271
273
|
kr as useNotifications,
|
|
272
274
|
Vo as useTheme,
|
|
273
275
|
oo as useTreeSelection,
|
|
274
|
-
|
|
276
|
+
la as useVLiteConfig,
|
|
275
277
|
Cr as vScrollReveal
|
|
276
278
|
};
|
package/package.json
CHANGED