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