vlite3 1.0.2 → 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.
@@ -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 g, computed as y, openBlock as o, createElementBlock as r, Fragment as v, renderList as b, createElementVNode as n, createVNode as u, toDisplayString as d, createBlock as f, unref as l, withCtx as k, createCommentVNode as h } from "vue";
2
- import p from "../Button.vue.js";
3
- import B from "../Modal.vue.js";
4
- import N from "../Icon.vue.js";
5
- import { $t as x } from "../../utils/i18n.js";
6
- import { downloadFile as z } from "../../utils/functions.js";
7
- import D from "../FilePreview/FilePreview.vue.js";
8
- const M = { class: "w-full" }, A = {
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-2"
11
- }, C = { class: "flex items-center gap-3 overflow-hidden" }, F = { class: "w-10 h-10 rounded-md bg-primary/10 flex items-center justify-center text-primary shrink-0" }, V = { class: "flex flex-col overflow-hidden" }, $ = ["title"], U = { class: "text-xs text-muted-foreground" }, P = { class: "flex items-center gap-1 shrink-0" }, S = {
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
- }, J = /* @__PURE__ */ g({
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(a) {
22
- const s = a, m = y(() => s.attachments ? Array.isArray(s.attachments) ? s.attachments : [s.attachments] : []), _ = (t) => {
23
- if (!t) return "0 Bytes";
24
- const c = 1024, e = ["Bytes", "KB", "MB", "GB"], i = Math.floor(Math.log(t) / Math.log(c));
25
- return parseFloat((t / Math.pow(c, i)).toFixed(2)) + " " + e[i];
26
- }, w = async (t) => {
27
- t.fileUrl && await z(t.fileUrl, t.fileName || "attachment");
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 (t, c) => (o(), r("div", M, [
30
- m.value.length > 0 ? (o(), r("div", A, [
31
- (o(!0), r(v, null, b(m.value, (e, i) => (o(), r("div", {
32
- key: i,
33
- class: "flex items-center justify-between p-3 border border-border rounded-lg bg-muted/20 hover:bg-muted/40 transition-colors"
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
- n("div", C, [
36
- n("div", F, [
37
- u(N, {
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
- n("div", V, [
43
- n("span", {
44
- class: "text-sm font-medium text-foreground truncate",
45
- title: e.fileName
46
- }, d(e.fileName || "Unnamed File"), 9, $),
47
- n("span", U, d(_(e.fileSize)), 1)
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
- n("div", P, [
51
- a.canView ? (o(), f(B, {
52
- key: 0,
53
- title: e.fileName || l(x)("common.words.preview", "Preview"),
54
- "max-width": "max-w-3xl",
55
- body: l(D),
56
- bodyProps: { url: e.fileUrl, name: e.fileName, canDownload: a.canDownload }
57
- }, {
58
- trigger: k(() => [
59
- u(p, {
60
- variant: "ghost",
61
- size: "sm",
62
- icon: "lucide:eye"
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
- _: 1
66
- }, 8, ["title", "body", "bodyProps"])) : h("", !0),
67
- a.canDownload ? (o(), f(p, {
68
- key: 1,
69
- variant: "ghost",
70
- size: "sm",
71
- icon: "lucide:download",
72
- onClick: (j) => w(e)
73
- }, null, 8, ["onClick"])) : h("", !0)
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
- ])) : (o(), r("div", S, d(l(x)("common.words.noAttachments", "No attachments found.")), 1))
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
- J as default
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
  }
@@ -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';
@@ -41,7 +41,7 @@ const D = /* @__PURE__ */ h({
41
41
  }, d(f.value), 3)) : u("", !0),
42
42
  t.showDate ? (r(), n("p", {
43
43
  key: 1,
44
- class: s(["text-fs-1 font-normal text-muted-foreground mt-3.5 tracking-wide", t.dateClass])
44
+ class: s(["text-fs-1 font-normal text-muted-foreground mt-2.5 tracking-wide", t.dateClass])
45
45
  }, d(v.value), 3)) : u("", !0)
46
46
  ], 2));
47
47
  }
@@ -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
- * injecting specified emitFields, and removing ignoreFields recursively.
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
- * object — meaning the user explicitly cleared a pre-existing value during
65
- * an update. In this case the canonical empty value (`[]` for multiSelect,
66
- * `null` for everything else) is sent so the backend overwrites the old data.
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 T(e) {
1
+ function U(e) {
2
2
  return !!e && typeof e == "object";
3
3
  }
4
- function S(e) {
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, t) {
8
- if (typeof e.type == "function" && !S(e.type))
7
+ function w(e, n) {
8
+ if (typeof e.type == "function" && !x(e.type))
9
9
  try {
10
- return e.type(t);
11
- } catch (s) {
12
- return console.error(`[vlite3/Form] Error evaluating dynamic type for field "${e.name}":`, s), "text";
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 A(e, t) {
17
- if (!t || !e) return;
18
- const s = t.split(".");
19
- let u = e;
20
- for (const f of s) {
21
- if (u == null) return;
22
- u = u[f];
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 u;
24
+ return a;
25
25
  }
26
- function g(e, t, s) {
27
- if (!t) return e;
28
- const u = t.split("."), f = { ...e };
29
- let l = f;
30
- for (let m = 0; m < u.length - 1; m++) {
31
- const n = u[m];
32
- Array.isArray(l[n]) ? l[n] = [...l[n]] : l[n] = l[n] ? { ...l[n] } : {}, l = l[n];
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 l[u[u.length - 1]] = s, f;
34
+ return f[a[a.length - 1]] = r, i;
35
35
  }
36
- function F(e, t) {
37
- return !T(t) || !t.name ? e : A(e, t.name) === void 0 && t.value !== void 0 ? g(e, t.name, t.value) : e;
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 U(e, t, s, u) {
40
- let f = t ? V(t) : {};
41
- const l = s || f, m = Array.isArray(e[0]) ? e.flat() : e;
42
- for (const n of m) {
43
- if (!n.name) continue;
44
- const v = { values: f, globalValues: l, isUpdate: u };
45
- if (n.when && !k(n.when, v))
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 h = n.mapFrom || n.name;
48
- let c = t ? A(t, h) : void 0;
49
- if (c != null) {
50
- const y = n.valueKey || n.key;
51
- y && (Array.isArray(c) ? c = c.map(
52
- (r) => r && typeof r == "object" ? A(r, y) : r
53
- ) : typeof c == "object" && (c = A(c, y))), n.format && (c = await n.format(c, t || {}));
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 (c === void 0) {
56
- if (n.mapFrom && t) {
57
- const y = A(t, n.name);
58
- y !== void 0 && (c = y);
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 (c === void 0) {
61
- const y = typeof n.value == "function" ? n.value() : n.value;
62
- y !== void 0 && Object.assign(f, g(f, n.name, y));
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(f, g(f, n.name, c));
64
+ Object.assign(i, g(i, t.name, o));
65
65
  } else
66
- Object.assign(f, g(f, n.name, c));
67
- if (f = F(f, n.addonLeft), f = F(f, n.addonRight), w(n, v) === "customFields" && n.props?.schema) {
68
- const y = n.props.schema;
69
- let r = A(f, n.name);
70
- if (Array.isArray(r) && r.length > 0) {
71
- const i = await Promise.all(
72
- r.map((o) => U(y, o, l, u))
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(f, g(f, n.name, i));
74
+ Object.assign(i, g(i, t.name, y));
75
75
  }
76
76
  }
77
77
  }
78
- return f;
78
+ return i;
79
79
  }
80
- function k(e, t) {
81
- return e === void 0 ? !1 : typeof e == "boolean" ? e : typeof e == "function" ? e(t) : !1;
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 $(e, t) {
84
- return Array.isArray(e) ? e.filter((s) => s ? !t.every((f) => {
85
- const l = s[f.name];
86
- return l == null || l === "";
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 j(e, t, s, u) {
90
- const f = [], l = s || t, m = Array.isArray(e[0]) ? e.flat() : e;
91
- for (const n of m) {
92
- if (!n.name) continue;
93
- const v = { values: t, globalValues: l, isUpdate: u };
94
- if (n.when && !k(n.when, v))
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 h = w(n, v);
97
- if (h === "file" || h === "avatarUpload" || h === "fileUploader") {
98
- const c = A(t, n.name);
99
- c && f.push({
100
- name: n.name,
101
- value: c,
102
- type: h,
103
- field: n
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 (h === "customFields" && n.props?.schema) {
107
- const c = A(t, n.name);
108
- if (Array.isArray(c)) {
109
- const r = n.props.schema.filter((i) => !S(i.type));
110
- r.length > 0 && c.forEach((i, o) => {
111
- r.forEach((a) => {
112
- const d = { values: i || {}, globalValues: l, isUpdate: u };
113
- if (a.when && !k(a.when, d))
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 p = w(a, d);
116
- if (p === "file" || p === "avatarUpload" || p === "fileUploader") {
117
- const b = i?.[a.name];
118
- b && f.push({
119
- name: `${n.name}.${o}.${a.name}`,
120
- value: b,
121
- type: p,
122
- field: a
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 f;
130
+ return i;
131
131
  }
132
- function V(e) {
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((s) => V(s));
137
- const t = {};
138
- for (const s in e)
139
- Object.prototype.hasOwnProperty.call(e, s) && (t[s] = V(e[s]));
140
- return t;
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 N(e, t) {
143
- const s = w(e, t);
144
- return s === "multiSelect" ? [] : s === "switch" || s === "check" ? !1 : null;
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 P(e) {
146
+ function K(e) {
147
147
  return !!(e == null || e === "" || Array.isArray(e) && e.length === 0);
148
148
  }
149
- async function K(e, t, s, u, f, l) {
150
- const m = s === void 0 && u === void 0, n = m ? V(e) : {}, v = f || e, h = Array.isArray(t[0]) ? t.flat() : t, c = s || [], y = [];
151
- for (const r of h) {
152
- if (!r.name) continue;
153
- const i = { values: e, globalValues: v, isUpdate: l };
154
- if (r.when && !k(r.when, i))
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 o = A(e, r.name);
157
- const a = r.name.split(".")[0], d = Object.prototype.hasOwnProperty.call(e, a), p = w(r, i);
158
- if (P(o)) {
159
- if (!d) continue;
160
- o = N(r, i);
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 (o = V(o), p === "customFields" && r.props?.schema && Array.isArray(o)) {
163
- const O = r.props.schema;
164
- o = await Promise.all(o.map((x) => K(x, O, s, u, v, l)));
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 b = !1;
167
- r.transform && (o = await r.transform(o, e), b = !0);
168
- const E = r.mapTo || r.name;
169
- E !== r.name && (b = !0, m && !r.name.includes(".") && delete n[r.name]), !m || b ? Object.assign(n, g(n, E, o)) : Object.assign(n, g(n, r.name, o));
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
- if (c.length > 0) {
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
- K as cleanSubmitValues,
213
- j as collectFileFields,
214
- V as deepClone,
215
- k as evaluateConditional,
216
- $ as filterNullCustomFields,
217
- A as getNestedValue,
218
- U as initializeFormValues,
219
- T as isAddonObject,
220
- S as isComponent,
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
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "private": false,
4
4
  "description": "A Vue 3 UI component library built with Tailwind CSS.",
5
5
  "license": "MIT",
6
- "version": "1.0.2",
6
+ "version": "1.0.3",
7
7
  "type": "module",
8
8
  "main": "index.js",
9
9
  "module": "index.js",
package/style.css CHANGED
@@ -459,7 +459,7 @@
459
459
  --color-danger-fg-light: #FCFCFC;
460
460
  --color-danger: #7F1D1D;
461
461
  --color-danger-fg: #ffffff;
462
- --color-danger-dark: #771d1c;
462
+ --color-danger-dark: #850e0c;
463
463
 
464
464
  /* Warning */
465
465
  --color-warning-light: #3a1e00;