@soft-stech/bootsman-ui-shadcn 1.3.6 → 1.3.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (24) hide show
  1. package/dist/{BuiAutoForm.vue_vue_type_script_setup_true_lang-BWWNpH1I.js → BuiAutoForm.vue_vue_type_script_setup_true_lang-DyG1WRf2.js} +23 -23
  2. package/dist/BuiAutoFormField.vue_vue_type_script_setup_true_lang-D0xFhEmy.js +284 -0
  3. package/dist/BuiAutoFormFieldObject.vue_vue_type_script_setup_true_lang-C7URAPKt.js +96 -0
  4. package/dist/{BuiDataTable.vue_vue_type_script_setup_true_lang-CUH3nl15.js → BuiDataTable.vue_vue_type_script_setup_true_lang-Bzw8CawP.js} +74 -68
  5. package/dist/assets/main.css +1 -1
  6. package/dist/components/ui/auto-form/BuiAutoForm.js +1 -1
  7. package/dist/components/ui/auto-form/BuiAutoFormField.js +1 -1
  8. package/dist/components/ui/auto-form/BuiAutoFormFieldArray.js +1 -1
  9. package/dist/components/ui/auto-form/BuiAutoFormFieldObject.js +1 -1
  10. package/dist/components/ui/auto-form/BuiAutoFormFieldObjectCard.js +4 -0
  11. package/dist/components/ui/auto-form/constant.js +5 -3
  12. package/dist/components/ui/auto-form/index.js +18 -17
  13. package/dist/components/ui/table/BuiDataTable.js +1 -1
  14. package/dist/components/ui/table/BuiDataTable.vue.d.ts +3 -0
  15. package/dist/components/ui/table/index.js +1 -1
  16. package/dist/index.js +70 -69
  17. package/package.json +1 -1
  18. package/src/components/stories/BuiAutoForm.story.vue +10 -0
  19. package/src/components/stories/BuiDataTable.story.vue +38 -4
  20. package/src/components/ui/auto-form/BuiAutoForm.vue +1 -1
  21. package/src/components/ui/auto-form/BuiAutoFormFieldObjectCard.vue +73 -0
  22. package/src/components/ui/auto-form/constant.ts +2 -1
  23. package/src/components/ui/table/BuiDataTable.vue +7 -1
  24. 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, normalizeProps as y, guardReactiveProps as F, withCtx as N, renderSlot as l, createElementBlock as j, Fragment as A, renderList as O, createVNode as $ } from "vue";
2
- import { toTypedSchema as D } from "@vee-validate/zod";
3
- import { getObjectFormSchema as P, 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-xmzLQDzl.js";
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-D0xFhEmy.js";
5
5
  import { provideDependencies as I } from "./components/ui/auto-form/dependencies.js";
6
- import { Form as R } from "vee-validate";
7
- const H = /* @__PURE__ */ b({
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 n = p, f = d, { dependencies: h } = C(n);
17
+ const s = p, f = d, { dependencies: h } = C(s);
18
18
  I(h);
19
19
  const a = c(() => {
20
- const e = {}, s = P(n.schema).shape;
21
- return Object.keys(s).forEach((o) => {
22
- const m = s[o], i = V(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 s = a.value[t];
35
+ const n = a.value[t];
36
36
  e[t] = {
37
- shape: s,
38
- config: n.fieldConfig?.[t],
37
+ shape: n,
38
+ config: s.fieldConfig?.[t],
39
39
  fieldName: t
40
40
  };
41
41
  }
42
42
  return e;
43
- }), v = c(() => n.form ? "form" : R), S = c(() => n.form ? {
44
- onSubmit: n.form.handleSubmit((e) => f("submit", e))
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: D(n.schema),
47
+ validationSchema: $(s.schema),
48
48
  onSubmit: (t) => f("submit", t)
49
49
  });
50
- return (e, t) => (u(), _(B(v.value), y(F(S.value)), {
51
- default: N(() => [
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(A, null, O(a.value, (s, o) => l(e.$slots, o.toString(), {
53
+ (u(!0), N(j, null, A(a.value, (n, o) => l(e.$slots, o.toString(), {
54
54
  key: o,
55
- shape: s,
55
+ shape: n,
56
56
  fieldName: o.toString(),
57
57
  config: e.fieldConfig?.[o]
58
58
  }, () => [
59
- $(E, {
59
+ O(E, {
60
60
  config: e.fieldConfig?.[o],
61
61
  "field-name": o.toString(),
62
- shape: s
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
- H as _
73
+ z as _
74
74
  };
@@ -0,0 +1,284 @@
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
+ };
@@ -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-D0xFhEmy.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
+ };