@soft-stech/bootsman-ui-shadcn 1.3.8 → 1.3.10
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{BuiAutoForm.vue_vue_type_script_setup_true_lang-BWWNpH1I.js → BuiAutoForm.vue_vue_type_script_setup_true_lang--BfJ5eim.js} +23 -23
- package/dist/BuiAutoFormField.vue_vue_type_script_setup_true_lang-BEazRmdY.js +265 -0
- package/dist/BuiAutoFormFieldArray.vue_vue_type_script_setup_true_lang-BoFRtjoQ.js +142 -0
- package/dist/BuiAutoFormFieldObject.vue_vue_type_script_setup_true_lang-CWpAoZW6.js +96 -0
- package/dist/assets/main.css +1 -1
- package/dist/components/ui/auto-form/BuiAutoForm.js +1 -1
- package/dist/components/ui/auto-form/BuiAutoFormField.js +1 -1
- package/dist/components/ui/auto-form/BuiAutoFormFieldArray.js +1 -1
- package/dist/components/ui/auto-form/BuiAutoFormFieldArrayCard.js +4 -0
- package/dist/components/ui/auto-form/BuiAutoFormFieldObject.js +1 -1
- package/dist/components/ui/auto-form/BuiAutoFormFieldObjectCard.js +4 -0
- package/dist/components/ui/auto-form/constant.js +6 -3
- package/dist/components/ui/auto-form/index.d.ts +2 -0
- package/dist/components/ui/auto-form/index.js +23 -19
- package/dist/index.js +97 -93
- package/package.json +1 -1
- package/src/components/stories/BuiAutoForm.story.vue +16 -0
- package/src/components/ui/auto-form/BuiAutoForm.vue +1 -1
- package/src/components/ui/auto-form/BuiAutoFormFieldArrayCard.vue +97 -0
- package/src/components/ui/auto-form/BuiAutoFormFieldObjectCard.vue +76 -0
- package/src/components/ui/auto-form/constant.ts +4 -2
- package/src/components/ui/auto-form/index.ts +2 -0
- package/dist/BuiAutoFormField.vue_vue_type_script_setup_true_lang-xmzLQDzl.js +0 -294
@@ -1,10 +1,10 @@
|
|
1
|
-
import { defineComponent as b, toRefs as C, computed as c, openBlock as u, createBlock as _, resolveDynamicComponent as B,
|
2
|
-
import { toTypedSchema as
|
3
|
-
import { getObjectFormSchema as
|
4
|
-
import { _ as E } from "./BuiAutoFormField.vue_vue_type_script_setup_true_lang-
|
1
|
+
import { defineComponent as b, toRefs as C, computed as c, openBlock as u, createBlock as _, resolveDynamicComponent as B, mergeProps as y, withCtx as F, renderSlot as l, createElementBlock as N, Fragment as j, renderList as A, createVNode as O } from "vue";
|
2
|
+
import { toTypedSchema as $ } from "@vee-validate/zod";
|
3
|
+
import { getObjectFormSchema as D, getBaseSchema as V, getBaseType as Z, getDefaultValueInZodStack as k } from "./components/ui/auto-form/utils.js";
|
4
|
+
import { _ as E } from "./BuiAutoFormField.vue_vue_type_script_setup_true_lang-BEazRmdY.js";
|
5
5
|
import { provideDependencies as I } from "./components/ui/auto-form/dependencies.js";
|
6
|
-
import { Form as
|
7
|
-
const
|
6
|
+
import { Form as P } from "vee-validate";
|
7
|
+
const z = /* @__PURE__ */ b({
|
8
8
|
__name: "BuiAutoForm",
|
9
9
|
props: {
|
10
10
|
schema: {},
|
@@ -14,12 +14,12 @@ const H = /* @__PURE__ */ b({
|
|
14
14
|
},
|
15
15
|
emits: ["submit"],
|
16
16
|
setup(p, { emit: d }) {
|
17
|
-
const
|
17
|
+
const s = p, f = d, { dependencies: h } = C(s);
|
18
18
|
I(h);
|
19
19
|
const a = c(() => {
|
20
|
-
const e = {},
|
21
|
-
return Object.keys(
|
22
|
-
const m =
|
20
|
+
const e = {}, n = D(s.schema).shape;
|
21
|
+
return Object.keys(n).forEach((o) => {
|
22
|
+
const m = n[o], i = V(m);
|
23
23
|
let r = i && "values" in i._def ? i._def.values : void 0;
|
24
24
|
!Array.isArray(r) && typeof r == "object" && (r = Object.values(r)), e[o] = {
|
25
25
|
type: Z(m),
|
@@ -32,34 +32,34 @@ const H = /* @__PURE__ */ b({
|
|
32
32
|
}), g = c(() => {
|
33
33
|
const e = {};
|
34
34
|
for (const t in a.value) {
|
35
|
-
const
|
35
|
+
const n = a.value[t];
|
36
36
|
e[t] = {
|
37
|
-
shape:
|
38
|
-
config:
|
37
|
+
shape: n,
|
38
|
+
config: s.fieldConfig?.[t],
|
39
39
|
fieldName: t
|
40
40
|
};
|
41
41
|
}
|
42
42
|
return e;
|
43
|
-
}), v = c(() =>
|
44
|
-
onSubmit:
|
43
|
+
}), v = c(() => s.form ? "form" : P), S = c(() => s.form ? {
|
44
|
+
onSubmit: s.form.handleSubmit((e) => f("submit", e))
|
45
45
|
} : {
|
46
46
|
keepValues: !0,
|
47
|
-
validationSchema:
|
47
|
+
validationSchema: $(s.schema),
|
48
48
|
onSubmit: (t) => f("submit", t)
|
49
49
|
});
|
50
|
-
return (e, t) => (u(), _(B(v.value), y(
|
51
|
-
default:
|
50
|
+
return (e, t) => (u(), _(B(v.value), y(S.value, { class: "flex flex-col gap-5" }), {
|
51
|
+
default: F(() => [
|
52
52
|
l(e.$slots, "customAutoForm", { fields: g.value }, () => [
|
53
|
-
(u(!0), j
|
53
|
+
(u(!0), N(j, null, A(a.value, (n, o) => l(e.$slots, o.toString(), {
|
54
54
|
key: o,
|
55
|
-
shape:
|
55
|
+
shape: n,
|
56
56
|
fieldName: o.toString(),
|
57
57
|
config: e.fieldConfig?.[o]
|
58
58
|
}, () => [
|
59
|
-
|
59
|
+
O(E, {
|
60
60
|
config: e.fieldConfig?.[o],
|
61
61
|
"field-name": o.toString(),
|
62
|
-
shape:
|
62
|
+
shape: n
|
63
63
|
}, null, 8, ["config", "field-name", "shape"])
|
64
64
|
])), 128))
|
65
65
|
]),
|
@@ -70,5 +70,5 @@ const H = /* @__PURE__ */ b({
|
|
70
70
|
}
|
71
71
|
});
|
72
72
|
export {
|
73
|
-
|
73
|
+
z as _
|
74
74
|
};
|
@@ -0,0 +1,265 @@
|
|
1
|
+
import { defineComponent as b, computed as y, provide as D, openBlock as c, createElementBlock as u, renderSlot as g, normalizeProps as F, guardReactiveProps as O, createVNode as t, unref as e, withCtx as r, createTextVNode as j, toDisplayString as S, Fragment as P, renderList as E, createBlock as _, createElementVNode as G, createCommentVNode as T, resolveDynamicComponent as J, mergeProps as Q } from "vue";
|
2
|
+
import * as $ from "zod";
|
3
|
+
import { useField as q, FieldContextKey as w, FieldArray as W } from "vee-validate";
|
4
|
+
import { _ as v } from "./BuiAutoFormFieldBoolean.vue_vue_type_script_setup_true_lang-tuxavlOe.js";
|
5
|
+
import { _ as X } from "./BuiAutoFormFieldDate.vue_vue_type_script_setup_true_lang-Bzg1m-ii.js";
|
6
|
+
import { _ as Z } from "./BuiAutoFormFieldEnum.vue_vue_type_script_setup_true_lang-Bqe8Rt85.js";
|
7
|
+
import { T as Y, _ as x } from "./BuiAutoFormFieldFile.vue_vue_type_script_setup_true_lang-DrJwn66q.js";
|
8
|
+
import { _ as C } from "./BuiAutoFormFieldInput.vue_vue_type_script_setup_true_lang-DtBFfiOK.js";
|
9
|
+
import { _ as ee } from "./BuiAutoFormFieldNumber.vue_vue_type_script_setup_true_lang-ClLqHM1Y.js";
|
10
|
+
import ae from "./components/ui/auto-form/dependencies.js";
|
11
|
+
import { getBaseSchema as k, getBaseType as I, getDefaultValueInZodStack as oe, beautifyObjectName as V } from "./components/ui/auto-form/utils.js";
|
12
|
+
import { _ as z } from "./BuiCard.vue_vue_type_script_setup_true_lang-CN_UnmV6.js";
|
13
|
+
import { _ as L } from "./BuiCardHeader.vue_vue_type_script_setup_true_lang-D9miAvuh.js";
|
14
|
+
import { _ as M } from "./BuiCardTitle.vue_vue_type_script_setup_true_lang-B6T0EtFW.js";
|
15
|
+
import { _ as R } from "./BuiCardContent.vue_vue_type_script_setup_true_lang-B6clSivQ.js";
|
16
|
+
import { _ as H } from "./BuiFormItem.vue_vue_type_script_setup_true_lang-COw7Rwow.js";
|
17
|
+
import { d as se, _ as A } from "./utils-DPuEjrVV.js";
|
18
|
+
import { _ as te } from "./BuiSeparator.vue_vue_type_script_setup_true_lang-DbN8eyHh.js";
|
19
|
+
import { _ as re } from "./BuiFormMessage.vue_vue_type_script_setup_true_lang-DTdflpS8.js";
|
20
|
+
/**
|
21
|
+
* @license lucide-vue-next v0.441.0 - ISC
|
22
|
+
*
|
23
|
+
* This source code is licensed under the ISC license.
|
24
|
+
* See the LICENSE file in the root directory of this source tree.
|
25
|
+
*/
|
26
|
+
const ne = se("PlusIcon", [
|
27
|
+
["path", { d: "M5 12h14", key: "1ays0h" }],
|
28
|
+
["path", { d: "M12 5v14", key: "s699le" }]
|
29
|
+
]), ie = /* @__PURE__ */ b({
|
30
|
+
__name: "BuiAutoFormFieldObjectCard",
|
31
|
+
props: {
|
32
|
+
fieldName: {},
|
33
|
+
required: { type: Boolean },
|
34
|
+
config: {},
|
35
|
+
schema: {},
|
36
|
+
disabled: { type: Boolean }
|
37
|
+
},
|
38
|
+
setup(m) {
|
39
|
+
const s = m, f = y(() => {
|
40
|
+
const n = {};
|
41
|
+
if (!s.schema) return;
|
42
|
+
const l = k(s.schema)?.shape;
|
43
|
+
if (l)
|
44
|
+
return Object.keys(l).forEach((a) => {
|
45
|
+
const i = l[a], o = k(i);
|
46
|
+
let d = o && "values" in o._def ? o._def.values : void 0;
|
47
|
+
!Array.isArray(d) && typeof d == "object" && (d = Object.values(d)), n[a] = {
|
48
|
+
type: I(i),
|
49
|
+
default: oe(i),
|
50
|
+
options: d,
|
51
|
+
required: !["ZodOptional", "ZodNullable"].includes(i._def.typeName),
|
52
|
+
schema: i
|
53
|
+
};
|
54
|
+
}), n;
|
55
|
+
}), p = q(s.fieldName);
|
56
|
+
return D(w, p), (n, l) => (c(), u("section", null, [
|
57
|
+
g(n.$slots, "default", F(O(s)), () => [
|
58
|
+
t(e(z), {
|
59
|
+
"as-child": "",
|
60
|
+
class: "w-full border-0 shadow-none"
|
61
|
+
}, {
|
62
|
+
default: r(() => [
|
63
|
+
t(e(H), null, {
|
64
|
+
default: r(() => [
|
65
|
+
t(e(L), { class: "border-b-[1px] border-b-border/[0.16] py-1" }, {
|
66
|
+
default: r(() => [
|
67
|
+
t(e(M), { class: "py-0 text-base" }, {
|
68
|
+
default: r(() => [
|
69
|
+
j(S(n.schema?.description || e(V)(n.fieldName.split(".")[n.fieldName.split(".").length - 1])), 1)
|
70
|
+
]),
|
71
|
+
_: 1
|
72
|
+
})
|
73
|
+
]),
|
74
|
+
_: 1
|
75
|
+
}),
|
76
|
+
t(e(R), { class: "flex flex-col gap-5 pb-0 pr-0" }, {
|
77
|
+
default: r(() => [
|
78
|
+
(c(!0), u(P, null, E(f.value, (a, i) => (c(), _(U, {
|
79
|
+
key: i,
|
80
|
+
config: n.config?.[i],
|
81
|
+
"field-name": `${n.fieldName}.${i.toString()}`,
|
82
|
+
label: i.toString(),
|
83
|
+
shape: a
|
84
|
+
}, null, 8, ["config", "field-name", "label", "shape"]))), 128))
|
85
|
+
]),
|
86
|
+
_: 1
|
87
|
+
})
|
88
|
+
]),
|
89
|
+
_: 1
|
90
|
+
})
|
91
|
+
]),
|
92
|
+
_: 1
|
93
|
+
})
|
94
|
+
])
|
95
|
+
]));
|
96
|
+
}
|
97
|
+
}), le = { class: "!my-4 flex justify-end" }, de = /* @__PURE__ */ b({
|
98
|
+
__name: "BuiAutoFormFieldArrayCard",
|
99
|
+
props: {
|
100
|
+
fieldName: {},
|
101
|
+
required: { type: Boolean },
|
102
|
+
config: {},
|
103
|
+
schema: {},
|
104
|
+
disabled: { type: Boolean }
|
105
|
+
},
|
106
|
+
setup(m) {
|
107
|
+
const s = m;
|
108
|
+
function f(a) {
|
109
|
+
return a instanceof $.ZodArray;
|
110
|
+
}
|
111
|
+
function p(a) {
|
112
|
+
return a instanceof $.ZodDefault;
|
113
|
+
}
|
114
|
+
const n = y(() => {
|
115
|
+
if (!s.schema) return;
|
116
|
+
const a = f(s.schema) ? s.schema._def.type : p(s.schema) ? (
|
117
|
+
// @ts-expect-error missing schema
|
118
|
+
s.schema._def.innerType._def.type
|
119
|
+
) : null;
|
120
|
+
return {
|
121
|
+
type: I(a),
|
122
|
+
schema: a
|
123
|
+
};
|
124
|
+
}), l = q(s.fieldName);
|
125
|
+
return D(w, l), (a, i) => (c(), _(e(W), {
|
126
|
+
as: "section",
|
127
|
+
name: a.fieldName
|
128
|
+
}, {
|
129
|
+
default: r(({ fields: o, remove: d, push: K }) => [
|
130
|
+
g(a.$slots, "default", F(O(s)), () => [
|
131
|
+
t(e(z), {
|
132
|
+
"as-child": "",
|
133
|
+
class: "w-full border-0 shadow-none"
|
134
|
+
}, {
|
135
|
+
default: r(() => [
|
136
|
+
t(e(H), null, {
|
137
|
+
default: r(() => [
|
138
|
+
t(e(L), { class: "border-b-[1px] border-b-border/[0.16] py-1" }, {
|
139
|
+
default: r(() => [
|
140
|
+
t(e(M), { class: "py-0 text-base" }, {
|
141
|
+
default: r(() => [
|
142
|
+
j(S(a.schema?.description || e(V)(a.fieldName.split(".")[a.fieldName.split(".").length - 1])), 1)
|
143
|
+
]),
|
144
|
+
_: 1
|
145
|
+
})
|
146
|
+
]),
|
147
|
+
_: 1
|
148
|
+
}),
|
149
|
+
t(e(R), { class: "flex flex-col gap-5 pb-0 pr-0" }, {
|
150
|
+
default: r(() => [
|
151
|
+
(c(!0), u(P, null, E(o, (h, N) => (c(), u("div", {
|
152
|
+
key: h.key,
|
153
|
+
class: "mb-4 p-1"
|
154
|
+
}, [
|
155
|
+
t(U, {
|
156
|
+
"field-name": `${a.fieldName}[${N}]`,
|
157
|
+
label: a.fieldName,
|
158
|
+
shape: n.value,
|
159
|
+
config: a.config
|
160
|
+
}, null, 8, ["field-name", "label", "shape", "config"]),
|
161
|
+
G("div", le, [
|
162
|
+
t(e(A), {
|
163
|
+
type: "button",
|
164
|
+
size: "icon",
|
165
|
+
variant: "secondary",
|
166
|
+
onClick: (me) => d(N)
|
167
|
+
}, {
|
168
|
+
default: r(() => [
|
169
|
+
t(e(Y), { size: 16 })
|
170
|
+
]),
|
171
|
+
_: 2
|
172
|
+
}, 1032, ["onClick"])
|
173
|
+
]),
|
174
|
+
h.isLast ? T("", !0) : (c(), _(e(te), { key: 0 }))
|
175
|
+
]))), 128)),
|
176
|
+
t(e(A), {
|
177
|
+
type: "button",
|
178
|
+
variant: "secondary",
|
179
|
+
class: "mt-4 flex items-center",
|
180
|
+
onClick: (h) => K(null)
|
181
|
+
}, {
|
182
|
+
default: r(() => [
|
183
|
+
t(e(ne), {
|
184
|
+
class: "mr-2",
|
185
|
+
size: 16
|
186
|
+
})
|
187
|
+
]),
|
188
|
+
_: 2
|
189
|
+
}, 1032, ["onClick"]),
|
190
|
+
t(e(re))
|
191
|
+
]),
|
192
|
+
_: 2
|
193
|
+
}, 1024)
|
194
|
+
]),
|
195
|
+
_: 2
|
196
|
+
}, 1024)
|
197
|
+
]),
|
198
|
+
_: 2
|
199
|
+
}, 1024)
|
200
|
+
])
|
201
|
+
]),
|
202
|
+
_: 3
|
203
|
+
}, 8, ["name"]));
|
204
|
+
}
|
205
|
+
}), B = {
|
206
|
+
date: X,
|
207
|
+
select: Z,
|
208
|
+
radio: Z,
|
209
|
+
checkbox: v,
|
210
|
+
switch: v,
|
211
|
+
textarea: C,
|
212
|
+
number: ee,
|
213
|
+
string: C,
|
214
|
+
file: x,
|
215
|
+
array: de,
|
216
|
+
object: ie
|
217
|
+
}, ce = {
|
218
|
+
ZodString: "string",
|
219
|
+
ZodBoolean: "checkbox",
|
220
|
+
ZodDate: "date",
|
221
|
+
ZodEnum: "select",
|
222
|
+
ZodNativeEnum: "select",
|
223
|
+
ZodNumber: "number",
|
224
|
+
ZodArray: "array",
|
225
|
+
ZodObject: "object"
|
226
|
+
}, U = /* @__PURE__ */ b({
|
227
|
+
__name: "BuiAutoFormField",
|
228
|
+
props: {
|
229
|
+
fieldName: {},
|
230
|
+
shape: {},
|
231
|
+
config: {}
|
232
|
+
},
|
233
|
+
setup(m) {
|
234
|
+
const s = m;
|
235
|
+
function f(o) {
|
236
|
+
return !!o?.component;
|
237
|
+
}
|
238
|
+
const p = y(() => {
|
239
|
+
if (["ZodObject", "ZodArray"].includes(s.shape?.type))
|
240
|
+
return { schema: s.shape?.schema };
|
241
|
+
}), { isDisabled: n, isHidden: l, isRequired: a, overrideOptions: i } = ae(s.fieldName);
|
242
|
+
return (o, d) => e(l) ? T("", !0) : (c(), _(J(f(o.config) ? typeof o.config.component == "string" ? e(B)[o.config.component] : o.config.component : e(B)[e(ce)[o.shape.type]]), Q({
|
243
|
+
key: 0,
|
244
|
+
"field-name": o.fieldName,
|
245
|
+
label: o.shape.schema?.description,
|
246
|
+
required: e(a) || o.shape.required,
|
247
|
+
options: e(i) || o.shape.options,
|
248
|
+
disabled: e(n),
|
249
|
+
config: o.config
|
250
|
+
}, p.value), {
|
251
|
+
default: r(() => [
|
252
|
+
g(o.$slots, "default")
|
253
|
+
]),
|
254
|
+
_: 3
|
255
|
+
}, 16, ["field-name", "label", "required", "options", "disabled", "config"]));
|
256
|
+
}
|
257
|
+
});
|
258
|
+
export {
|
259
|
+
ce as D,
|
260
|
+
B as I,
|
261
|
+
ne as P,
|
262
|
+
U as _,
|
263
|
+
ie as a,
|
264
|
+
de as b
|
265
|
+
};
|
@@ -0,0 +1,142 @@
|
|
1
|
+
import { defineComponent as k, computed as C, provide as g, openBlock as s, createBlock as m, unref as a, withCtx as r, renderSlot as B, normalizeProps as A, guardReactiveProps as F, createVNode as t, createTextVNode as f, toDisplayString as z, createElementBlock as d, Fragment as T, renderList as q, createElementVNode as P, createCommentVNode as V } from "vue";
|
2
|
+
import * as c from "zod";
|
3
|
+
import { useField as Z, FieldContextKey as D, FieldArray as S } from "vee-validate";
|
4
|
+
import { getBaseType as j, beautifyObjectName as w } from "./components/ui/auto-form/utils.js";
|
5
|
+
import { _ as E, P as L } from "./BuiAutoFormField.vue_vue_type_script_setup_true_lang-BEazRmdY.js";
|
6
|
+
import { _ as K } from "./BuiAutoFormLabel.vue_vue_type_script_setup_true_lang-DzpWjTLE.js";
|
7
|
+
import { _ as O } from "./BuiAccordion.vue_vue_type_script_setup_true_lang-nxe3iIoM.js";
|
8
|
+
import { _ as R } from "./BuiAccordionContent.vue_vue_type_script_setup_true_lang-pCTYRg2Z.js";
|
9
|
+
import { _ as G } from "./BuiAccordionItem.vue_vue_type_script_setup_true_lang-Dp-3E0FN.js";
|
10
|
+
import { _ as H } from "./BuiAccordionTrigger.vue_vue_type_script_setup_true_lang-CtFZfwMC.js";
|
11
|
+
import { _ as u } from "./utils-DPuEjrVV.js";
|
12
|
+
import { _ as I } from "./BuiSeparator.vue_vue_type_script_setup_true_lang-DbN8eyHh.js";
|
13
|
+
import { _ as J } from "./BuiFormItem.vue_vue_type_script_setup_true_lang-COw7Rwow.js";
|
14
|
+
import { _ as M } from "./BuiFormMessage.vue_vue_type_script_setup_true_lang-DTdflpS8.js";
|
15
|
+
import { T as Q } from "./BuiAutoFormFieldFile.vue_vue_type_script_setup_true_lang-DrJwn66q.js";
|
16
|
+
const U = { class: "!my-4 flex justify-end" }, de = /* @__PURE__ */ k({
|
17
|
+
__name: "BuiAutoFormFieldArray",
|
18
|
+
props: {
|
19
|
+
fieldName: {},
|
20
|
+
required: { type: Boolean },
|
21
|
+
config: {},
|
22
|
+
schema: {},
|
23
|
+
disabled: { type: Boolean }
|
24
|
+
},
|
25
|
+
setup(p) {
|
26
|
+
const o = p;
|
27
|
+
function _(e) {
|
28
|
+
return e instanceof c.ZodArray;
|
29
|
+
}
|
30
|
+
function y(e) {
|
31
|
+
return e instanceof c.ZodDefault;
|
32
|
+
}
|
33
|
+
const $ = C(() => {
|
34
|
+
if (!o.schema) return;
|
35
|
+
const e = _(o.schema) ? o.schema._def.type : y(o.schema) ? (
|
36
|
+
// @ts-expect-error missing schema
|
37
|
+
o.schema._def.innerType._def.type
|
38
|
+
) : null;
|
39
|
+
return {
|
40
|
+
type: j(e),
|
41
|
+
schema: e
|
42
|
+
};
|
43
|
+
}), b = Z(o.fieldName);
|
44
|
+
return g(D, b), (e, n) => (s(), m(a(S), {
|
45
|
+
as: "section",
|
46
|
+
name: e.fieldName
|
47
|
+
}, {
|
48
|
+
default: r(({ fields: h, remove: N, push: v }) => [
|
49
|
+
B(e.$slots, "default", A(F(o)), () => [
|
50
|
+
t(a(O), {
|
51
|
+
type: "multiple",
|
52
|
+
class: "w-full",
|
53
|
+
collapsible: "",
|
54
|
+
disabled: e.disabled,
|
55
|
+
"as-child": ""
|
56
|
+
}, {
|
57
|
+
default: r(() => [
|
58
|
+
t(a(J), null, {
|
59
|
+
default: r(() => [
|
60
|
+
t(a(G), {
|
61
|
+
value: e.fieldName,
|
62
|
+
class: "border-none"
|
63
|
+
}, {
|
64
|
+
default: r(() => [
|
65
|
+
t(a(H), null, {
|
66
|
+
default: r(() => [
|
67
|
+
t(K, {
|
68
|
+
class: "text-base",
|
69
|
+
required: e.required
|
70
|
+
}, {
|
71
|
+
default: r(() => [
|
72
|
+
f(z(e.schema?.description || a(w)(e.fieldName)), 1)
|
73
|
+
]),
|
74
|
+
_: 1
|
75
|
+
}, 8, ["required"])
|
76
|
+
]),
|
77
|
+
_: 1
|
78
|
+
}),
|
79
|
+
t(a(R), null, {
|
80
|
+
default: r(() => [
|
81
|
+
(s(!0), d(T, null, q(h, (i, l) => (s(), d("div", {
|
82
|
+
key: i.key,
|
83
|
+
class: "mb-4 p-1"
|
84
|
+
}, [
|
85
|
+
t(E, {
|
86
|
+
"field-name": `${e.fieldName}[${l}]`,
|
87
|
+
label: e.fieldName,
|
88
|
+
shape: $.value,
|
89
|
+
config: e.config
|
90
|
+
}, null, 8, ["field-name", "label", "shape", "config"]),
|
91
|
+
P("div", U, [
|
92
|
+
t(a(u), {
|
93
|
+
type: "button",
|
94
|
+
size: "icon",
|
95
|
+
variant: "secondary",
|
96
|
+
onClick: (W) => N(l)
|
97
|
+
}, {
|
98
|
+
default: r(() => [
|
99
|
+
t(a(Q), { size: 16 })
|
100
|
+
]),
|
101
|
+
_: 2
|
102
|
+
}, 1032, ["onClick"])
|
103
|
+
]),
|
104
|
+
i.isLast ? V("", !0) : (s(), m(a(I), { key: 0 }))
|
105
|
+
]))), 128)),
|
106
|
+
t(a(u), {
|
107
|
+
type: "button",
|
108
|
+
variant: "secondary",
|
109
|
+
class: "mt-4 flex items-center",
|
110
|
+
onClick: (i) => v(null)
|
111
|
+
}, {
|
112
|
+
default: r(() => [
|
113
|
+
t(a(L), {
|
114
|
+
class: "mr-2",
|
115
|
+
size: 16
|
116
|
+
}),
|
117
|
+
n[0] || (n[0] = f(" Add "))
|
118
|
+
]),
|
119
|
+
_: 2
|
120
|
+
}, 1032, ["onClick"])
|
121
|
+
]),
|
122
|
+
_: 2
|
123
|
+
}, 1024),
|
124
|
+
t(a(M))
|
125
|
+
]),
|
126
|
+
_: 2
|
127
|
+
}, 1032, ["value"])
|
128
|
+
]),
|
129
|
+
_: 2
|
130
|
+
}, 1024)
|
131
|
+
]),
|
132
|
+
_: 2
|
133
|
+
}, 1032, ["disabled"])
|
134
|
+
])
|
135
|
+
]),
|
136
|
+
_: 3
|
137
|
+
}, 8, ["name"]));
|
138
|
+
}
|
139
|
+
});
|
140
|
+
export {
|
141
|
+
de as _
|
142
|
+
};
|
@@ -0,0 +1,96 @@
|
|
1
|
+
import { defineComponent as b, computed as h, provide as g, openBlock as f, createElementBlock as m, renderSlot as y, normalizeProps as v, guardReactiveProps as N, createVNode as t, unref as o, withCtx as l, createTextVNode as $, toDisplayString as B, Fragment as S, renderList as j, createBlock as q } from "vue";
|
2
|
+
import { useField as F, FieldContextKey as O } from "vee-validate";
|
3
|
+
import { _ as C } from "./BuiAutoFormField.vue_vue_type_script_setup_true_lang-BEazRmdY.js";
|
4
|
+
import { getBaseSchema as c, getBaseType as A, getDefaultValueInZodStack as V, beautifyObjectName as Z } from "./components/ui/auto-form/utils.js";
|
5
|
+
import { _ as k } from "./BuiAutoFormLabel.vue_vue_type_script_setup_true_lang-DzpWjTLE.js";
|
6
|
+
import { _ as w } from "./BuiAccordion.vue_vue_type_script_setup_true_lang-nxe3iIoM.js";
|
7
|
+
import { _ as D } from "./BuiAccordionContent.vue_vue_type_script_setup_true_lang-pCTYRg2Z.js";
|
8
|
+
import { _ as E } from "./BuiAccordionItem.vue_vue_type_script_setup_true_lang-Dp-3E0FN.js";
|
9
|
+
import { _ as I } from "./BuiAccordionTrigger.vue_vue_type_script_setup_true_lang-CtFZfwMC.js";
|
10
|
+
import { _ as P } from "./BuiFormItem.vue_vue_type_script_setup_true_lang-COw7Rwow.js";
|
11
|
+
const U = /* @__PURE__ */ b({
|
12
|
+
__name: "BuiAutoFormFieldObject",
|
13
|
+
props: {
|
14
|
+
fieldName: {},
|
15
|
+
required: { type: Boolean },
|
16
|
+
config: {},
|
17
|
+
schema: {},
|
18
|
+
disabled: { type: Boolean }
|
19
|
+
},
|
20
|
+
setup(u) {
|
21
|
+
const s = u, p = h(() => {
|
22
|
+
const e = {};
|
23
|
+
if (!s.schema) return;
|
24
|
+
const i = c(s.schema)?.shape;
|
25
|
+
if (i)
|
26
|
+
return Object.keys(i).forEach((n) => {
|
27
|
+
const a = i[n], d = c(a);
|
28
|
+
let r = d && "values" in d._def ? d._def.values : void 0;
|
29
|
+
!Array.isArray(r) && typeof r == "object" && (r = Object.values(r)), e[n] = {
|
30
|
+
type: A(a),
|
31
|
+
default: V(a),
|
32
|
+
options: r,
|
33
|
+
required: !["ZodOptional", "ZodNullable"].includes(a._def.typeName),
|
34
|
+
schema: a
|
35
|
+
};
|
36
|
+
}), e;
|
37
|
+
}), _ = F(s.fieldName);
|
38
|
+
return g(O, _), (e, i) => (f(), m("section", null, [
|
39
|
+
y(e.$slots, "default", v(N(s)), () => [
|
40
|
+
t(o(w), {
|
41
|
+
type: "single",
|
42
|
+
"as-child": "",
|
43
|
+
class: "w-full",
|
44
|
+
collapsible: "",
|
45
|
+
disabled: e.disabled
|
46
|
+
}, {
|
47
|
+
default: l(() => [
|
48
|
+
t(o(P), null, {
|
49
|
+
default: l(() => [
|
50
|
+
t(o(E), {
|
51
|
+
value: e.fieldName,
|
52
|
+
class: "border-none"
|
53
|
+
}, {
|
54
|
+
default: l(() => [
|
55
|
+
t(o(I), null, {
|
56
|
+
default: l(() => [
|
57
|
+
t(k, {
|
58
|
+
class: "text-base",
|
59
|
+
required: e.required
|
60
|
+
}, {
|
61
|
+
default: l(() => [
|
62
|
+
$(B(e.schema?.description || o(Z)(e.fieldName)), 1)
|
63
|
+
]),
|
64
|
+
_: 1
|
65
|
+
}, 8, ["required"])
|
66
|
+
]),
|
67
|
+
_: 1
|
68
|
+
}),
|
69
|
+
t(o(D), { class: "space-y-5 p-1" }, {
|
70
|
+
default: l(() => [
|
71
|
+
(f(!0), m(S, null, j(p.value, (n, a) => (f(), q(C, {
|
72
|
+
key: a,
|
73
|
+
config: e.config?.[a],
|
74
|
+
"field-name": `${e.fieldName}.${a.toString()}`,
|
75
|
+
label: a.toString(),
|
76
|
+
shape: n
|
77
|
+
}, null, 8, ["config", "field-name", "label", "shape"]))), 128))
|
78
|
+
]),
|
79
|
+
_: 1
|
80
|
+
})
|
81
|
+
]),
|
82
|
+
_: 1
|
83
|
+
}, 8, ["value"])
|
84
|
+
]),
|
85
|
+
_: 1
|
86
|
+
})
|
87
|
+
]),
|
88
|
+
_: 1
|
89
|
+
}, 8, ["disabled"])
|
90
|
+
])
|
91
|
+
]));
|
92
|
+
}
|
93
|
+
});
|
94
|
+
export {
|
95
|
+
U as _
|
96
|
+
};
|