@caipira/tamandua 0.0.34 → 0.0.36

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.
Files changed (34) hide show
  1. package/dist/Form.js +2 -2
  2. package/dist/Form.vue_vue_type_script_setup_true_lang-Cf0LqvyX.js +203 -0
  3. package/dist/InputSelect.js +2 -2
  4. package/dist/{InputSelect.vue_vue_type_script_setup_true_lang-BlA3DIYZ.js → InputSelect.vue_vue_type_script_setup_true_lang-vCtwK795.js} +4 -1
  5. package/dist/ModalForm.js +2 -2
  6. package/dist/{ModalForm.vue_vue_type_script_setup_true_lang-BpkPebgZ.js → ModalForm.vue_vue_type_script_setup_true_lang-Da80UtoI.js} +1 -1
  7. package/dist/components.js +3 -3
  8. package/dist/{plugin-BkoyYU7S.js → plugin-BFAUI0U3.js} +1 -1
  9. package/dist/{plugin-JFEZqDsu.js → plugin-BqzDqLcd.js} +1 -1
  10. package/dist/{plugin-Daf_swsz.js → plugin-cVdTR_s6.js} +1 -1
  11. package/dist/{plugins-Bc8aBhAD.js → plugins-DLfHiPSG.js} +5 -5
  12. package/dist/plugins.js +5 -5
  13. package/dist/tamandua.js +1 -1
  14. package/dist/types/components/Button/Button.vue.d.ts +1 -1
  15. package/dist/types/components/Dropdown/types.d.ts +3 -3
  16. package/dist/types/components/Form/Form.vue.d.ts +3 -6
  17. package/dist/types/components/Form/types.d.ts +0 -1
  18. package/dist/types/components/InputPassword/index.d.ts +1 -1
  19. package/dist/types/components/InputPassword/types.d.ts +1 -1
  20. package/dist/types/components/InputPrice/index.d.ts +1 -1
  21. package/dist/types/components/InputSelect/InputSelect.story.d.ts +3 -3
  22. package/dist/types/components/InputSelect/InputSelect.vue.d.ts +8 -8
  23. package/dist/types/components/InputSelect/index.d.ts +1 -1
  24. package/dist/types/components/InputSelect/types.d.ts +8 -8
  25. package/dist/types/components/ModalForm/ModalForm.vue.d.ts +1 -1
  26. package/dist/types/components/ModalForm/types.d.ts +2 -2
  27. package/dist/types/components/index.d.ts +43 -44
  28. package/dist/types/components/types.d.ts +45 -0
  29. package/dist/types/form/crud.d.ts +1 -1
  30. package/dist/types/{composables → form}/useForm.d.ts +1 -2
  31. package/dist/types/types/index.d.ts +1 -0
  32. package/package.json +2 -2
  33. package/dist/Form.vue_vue_type_script_setup_true_lang-O6nqLPyU.js +0 -205
  34. /package/dist/types/{composables → form}/useForm.test.d.ts +0 -0
package/dist/Form.js CHANGED
@@ -1,5 +1,5 @@
1
- import { _ as m } from "./Form.vue_vue_type_script_setup_true_lang-O6nqLPyU.js";
2
- import { p as a } from "./plugin-BkoyYU7S.js";
1
+ import { _ as m } from "./Form.vue_vue_type_script_setup_true_lang-Cf0LqvyX.js";
2
+ import { p as a } from "./plugin-BFAUI0U3.js";
3
3
  export {
4
4
  m as Form,
5
5
  a as FormPlugin
@@ -0,0 +1,203 @@
1
+ import { reactive as D, defineComponent as C, ref as A, computed as P, watch as _, provide as T, resolveComponent as N, openBlock as O, createElementBlock as B, renderSlot as J, unref as E, createElementVNode as R, normalizeClass as W, withDirectives as j, createVNode as M, mergeProps as z, vShow as L } from "vue";
2
+ import { B as I } from "./ui-BC6H9E93.js";
3
+ import { F as s, a as p } from "./form-BkXpIJ0e.js";
4
+ import { f as Y } from "./index-CjvqeRf7.js";
5
+ const w = (t) => t ? Y(t, "yyyy-MM-dd") : "", y = (t) => [`${t?.iso}`, `${t?.value}`], h = (t) => t?.iso2 ?? "", F = async (t) => t?.hash ? t.hash : t?.raw ?? "", i = {
6
+ default: (t, r, e) => (r[e] = t, r),
7
+ price: (t, r, e, n = ["Currency", "Value"]) => {
8
+ const [u, a] = y(t);
9
+ return r[`${e}${n[0]}`] = u, r[`${e}${n[1]}`] = a, r;
10
+ },
11
+ password: async (t, r, e) => (r[e] = await F(t), r),
12
+ stringArray: (t, r, e) => (r[e] = t, r)
13
+ }, q = async (t, r, e, n) => {
14
+ switch (t) {
15
+ case s.Country:
16
+ return i.default(
17
+ h(e),
18
+ r,
19
+ n
20
+ );
21
+ case s.Documents:
22
+ return i.default(e, r, n);
23
+ case s.Date:
24
+ return i.default(
25
+ w(e),
26
+ r,
27
+ n
28
+ );
29
+ case s.Address:
30
+ return i.default(e, r, n);
31
+ case s.Price:
32
+ return i.price(e, r, n);
33
+ case s.Password:
34
+ return await i.password(e, r, n);
35
+ case s.StringArray:
36
+ return i.stringArray(e, r, n);
37
+ default:
38
+ return i.default(e, r, n);
39
+ }
40
+ }, f = (t) => (t == null ? t = "" : typeof t == "object" ? t = JSON.stringify(t) : typeof t == "number" ? t = t.toString() : typeof t == "boolean" && (t = t ? "1" : "0"), t), c = {
41
+ default: (t, r, e) => {
42
+ const n = f(t);
43
+ return t && r.append(e, n), r;
44
+ },
45
+ price: (t, r, e, n = ["Currency", "Value"]) => {
46
+ const [u, a] = y(t);
47
+ return r.append(`${e}${n[0]}`, f(u)), r.append(`${e}${n[1]}`, f(a)), r;
48
+ },
49
+ address: (t, r, e) => (r.append(
50
+ e,
51
+ JSON.stringify({
52
+ ...t,
53
+ country: h(t?.country)
54
+ })
55
+ ), r),
56
+ documents: (t, r, e) => (e.endsWith("[]") || (e = `${e}[]`), Array.from(t).forEach((n) => r.append(e, n)), r),
57
+ document: (t, r, e) => (r.append(e, t), r),
58
+ stringArray: (t, r, e) => (e.endsWith("[]") || (e = `${e}[]`), t.forEach((n) => r.append(e, f(n))), r)
59
+ }, x = async (t, r, e, n) => {
60
+ switch (t) {
61
+ case s.Country:
62
+ return c.default(
63
+ h(e),
64
+ r,
65
+ n
66
+ );
67
+ case s.Document:
68
+ return c.document(e, r, n);
69
+ case s.Documents:
70
+ return c.documents(e, r, n);
71
+ case s.Date:
72
+ return c.default(
73
+ w(e),
74
+ r,
75
+ n
76
+ );
77
+ case s.Address:
78
+ return c.address(e, r, n);
79
+ case s.Price:
80
+ return c.price(e, r, n);
81
+ case s.Password:
82
+ return c.default(
83
+ await F(e),
84
+ r,
85
+ n
86
+ );
87
+ case s.StringArray:
88
+ return c.stringArray(e, r, n);
89
+ default:
90
+ return c.default(e, r, n);
91
+ }
92
+ }, G = async (t, r, e) => {
93
+ switch (e) {
94
+ case p.JSON:
95
+ let n = {};
96
+ for (const a in t)
97
+ n = await q(
98
+ r[a],
99
+ n,
100
+ t[a],
101
+ a
102
+ );
103
+ return n;
104
+ case p.FormData:
105
+ default:
106
+ let u = new FormData();
107
+ for (const a in t)
108
+ u = await x(
109
+ r[a],
110
+ u,
111
+ t[a],
112
+ a
113
+ );
114
+ return u;
115
+ }
116
+ };
117
+ function H(t) {
118
+ const r = D(
119
+ {}
120
+ );
121
+ return { form: r, setValue: (o, m) => {
122
+ r[o] = m;
123
+ }, setValues: (o) => {
124
+ for (const [m, b] of Object.entries(o))
125
+ r[m] = b;
126
+ }, getValue: (o) => r[o], reset: () => {
127
+ for (const o in r)
128
+ delete r[o];
129
+ }, submit: async () => {
130
+ const o = {
131
+ ...r
132
+ };
133
+ return t.id && t.id.value && (o.id = t.id.value), {
134
+ isValid: !0,
135
+ form: await G(
136
+ o,
137
+ t.schema,
138
+ t.format ?? p.JSON
139
+ )
140
+ };
141
+ } };
142
+ }
143
+ const v = /* @__PURE__ */ C({
144
+ name: "TForm",
145
+ __name: "Form",
146
+ props: {
147
+ id: { default: "" },
148
+ schema: { default: () => ({}) },
149
+ formStyle: { default: () => ({}) },
150
+ showSubmit: { type: Boolean, default: !1 },
151
+ submitLabel: { default: "Submit" },
152
+ buttonProps: {},
153
+ buttonVariant: { default: I.PRIMARY },
154
+ submissionFormat: { default: p.FormData },
155
+ buttonWrapperClasses: { default: "" }
156
+ },
157
+ emits: ["submit", "change"],
158
+ setup(t, { expose: r, emit: e }) {
159
+ const n = t, u = e, a = A(), { form: l, getValue: o, setValue: m, setValues: b, reset: S, submit: g } = H({
160
+ id: P(() => n.id),
161
+ schema: n.schema,
162
+ format: n.submissionFormat
163
+ }), V = async () => {
164
+ const d = await g();
165
+ return u("submit", d), d;
166
+ };
167
+ return _(l, (d) => {
168
+ u("change", d);
169
+ }), T("formStyle", n.formStyle), r({
170
+ submit: V,
171
+ reset: S,
172
+ setValues: b,
173
+ form: l,
174
+ setValue: m,
175
+ getValue: o
176
+ }), (d, K) => {
177
+ const $ = N("t-button");
178
+ return O(), B("form", {
179
+ onSubmit: V,
180
+ ref_key: "formReference",
181
+ ref: a
182
+ }, [
183
+ J(d.$slots, "default", { form: E(l) }),
184
+ R("div", {
185
+ class: W([n.buttonWrapperClasses])
186
+ }, [
187
+ j(M($, z(n.buttonProps, {
188
+ type: "submit",
189
+ class: "mt-4",
190
+ variant: n.buttonVariant,
191
+ label: n.submitLabel,
192
+ onClick: V
193
+ }), null, 16, ["variant", "label"]), [
194
+ [L, n.showSubmit]
195
+ ])
196
+ ], 2)
197
+ ], 544);
198
+ };
199
+ }
200
+ });
201
+ export {
202
+ v as _
203
+ };
@@ -1,5 +1,5 @@
1
- import { _ as p } from "./InputSelect.vue_vue_type_script_setup_true_lang-BlA3DIYZ.js";
2
- import { p as r } from "./plugin-Daf_swsz.js";
1
+ import { _ as p } from "./InputSelect.vue_vue_type_script_setup_true_lang-vCtwK795.js";
2
+ import { p as r } from "./plugin-cVdTR_s6.js";
3
3
  export {
4
4
  p as InputSelect,
5
5
  r as InputSelectPlugin
@@ -12,7 +12,10 @@ const ce = ["placeholder", "disabled", "readonly"], de = { key: 1 }, fe = {
12
12
  props: {
13
13
  size: { default: re.Default },
14
14
  options: { default: () => [] },
15
- mapper: { type: Function, default: (f) => ({ value: f.id ?? f.uuid, label: f }) },
15
+ mapper: { type: Function, default: (f) => ({
16
+ value: f.id ?? f.uuid,
17
+ label: f
18
+ }) },
16
19
  filter: { type: Function, default: (f, T) => T.label.toLowerCase().indexOf(f.toLowerCase()) >= 0 },
17
20
  tooltip: { default: "" },
18
21
  disabled: { type: Boolean },
package/dist/ModalForm.js CHANGED
@@ -1,5 +1,5 @@
1
- import { _ as a } from "./ModalForm.vue_vue_type_script_setup_true_lang-BpkPebgZ.js";
2
- import { p as l } from "./plugin-JFEZqDsu.js";
1
+ import { _ as a } from "./ModalForm.vue_vue_type_script_setup_true_lang-Da80UtoI.js";
2
+ import { p as l } from "./plugin-BqzDqLcd.js";
3
3
  export {
4
4
  a as ModalForm,
5
5
  l as ModalFormPlugin
@@ -13,7 +13,7 @@ const I = {
13
13
  },
14
14
  emits: ["saved", "closed"],
15
15
  setup(y, { expose: C, emit: k }) {
16
- const i = y, v = k, e = c(null), p = c(!1), f = c(""), r = c(), s = N(() => i.forms.find((u) => u.key === f.value)), g = (u, t) => {
16
+ const i = y, v = k, e = c(), p = c(!1), f = c(""), r = c(), s = N(() => i.forms.find((u) => u.key === f.value)), g = (u, t) => {
17
17
  f.value = u, e.value = new A(s.value?.title, r), t ? e.value?.edit(t) : e.value?.show();
18
18
  }, w = () => {
19
19
  e.value?.onSave(!p.value), v("saved");
@@ -6,7 +6,7 @@ import { _ as n } from "./ChartTreemap.vue_vue_type_script_setup_true_lang-DzIPu
6
6
  import { D as u } from "./Drawer-omdZnBPG.js";
7
7
  import { _ as l } from "./Dropdown.vue_vue_type_script_setup_true_lang-pjG__bX2.js";
8
8
  import { _ as h } from "./FileDrop.vue_vue_type_script_setup_true_lang-DLEH_LLX.js";
9
- import { _ as T } from "./Form.vue_vue_type_script_setup_true_lang-O6nqLPyU.js";
9
+ import { _ as T } from "./Form.vue_vue_type_script_setup_true_lang-Cf0LqvyX.js";
10
10
  import { _ as y } from "./FormItem.vue_vue_type_script_setup_true_lang-CjW-P8Xf.js";
11
11
  import { _ as C } from "./GraphyEmpty.vue_vue_type_script_setup_true_lang-B-hAjDCw.js";
12
12
  import { _ as G } from "./GraphyLabel.vue_vue_type_script_setup_true_lang-n_0200p7.js";
@@ -24,13 +24,13 @@ import { _ as U } from "./InputPhone.vue_vue_type_script_setup_true_lang-B4TULqL
24
24
  import { _ as W } from "./InputPrice.vue_vue_type_script_setup_true_lang-BX4rsYIr.js";
25
25
  import { _ as Y } from "./InputRadio.vue_vue_type_script_setup_true_lang-Cu7lzDAh.js";
26
26
  import "vue";
27
- import { _ as $ } from "./InputSelect.vue_vue_type_script_setup_true_lang-BlA3DIYZ.js";
27
+ import { _ as $ } from "./InputSelect.vue_vue_type_script_setup_true_lang-vCtwK795.js";
28
28
  import { _ as or } from "./InputSwitch.vue_vue_type_script_setup_true_lang-Dq_U-mFJ.js";
29
29
  import { _ as er } from "./InputText.vue_vue_type_script_setup_true_lang-Dyvx9Ob-.js";
30
30
  import { _ as pr } from "./InputTextarea.vue_vue_type_script_setup_true_lang-DRo5eIw4.js";
31
31
  import { _ as sr } from "./Link.vue_vue_type_script_setup_true_lang-DeBJ2UGi.js";
32
32
  import { _ as fr } from "./Modal.vue_vue_type_script_setup_true_lang-DLl5shGS.js";
33
- import { _ as nr } from "./ModalForm.vue_vue_type_script_setup_true_lang-BpkPebgZ.js";
33
+ import { _ as nr } from "./ModalForm.vue_vue_type_script_setup_true_lang-Da80UtoI.js";
34
34
  import { _ as ur } from "./Pagination.vue_vue_type_script_setup_true_lang-PLZQJUd0.js";
35
35
  import { _ as lr } from "./Popconfirm.vue_vue_type_script_setup_true_lang-XyjBUx0p.js";
36
36
  import { _ as hr } from "./Popover.vue_vue_type_script_setup_true_lang-dnL75W40.js";
@@ -1,5 +1,5 @@
1
1
  import { r } from "./register-component-B-fdqewb.js";
2
- import { _ as s } from "./Form.vue_vue_type_script_setup_true_lang-O6nqLPyU.js";
2
+ import { _ as s } from "./Form.vue_vue_type_script_setup_true_lang-Cf0LqvyX.js";
3
3
  const m = {
4
4
  install(o) {
5
5
  r(o, s);
@@ -1,5 +1,5 @@
1
1
  import { r } from "./register-component-B-fdqewb.js";
2
- import { _ as s } from "./ModalForm.vue_vue_type_script_setup_true_lang-BpkPebgZ.js";
2
+ import { _ as s } from "./ModalForm.vue_vue_type_script_setup_true_lang-Da80UtoI.js";
3
3
  const m = {
4
4
  install(o) {
5
5
  r(o, s);
@@ -1,5 +1,5 @@
1
1
  import { r } from "./register-component-B-fdqewb.js";
2
- import { _ as s } from "./InputSelect.vue_vue_type_script_setup_true_lang-BlA3DIYZ.js";
2
+ import { _ as s } from "./InputSelect.vue_vue_type_script_setup_true_lang-vCtwK795.js";
3
3
  const m = {
4
4
  install(o) {
5
5
  r(o, s);
@@ -12,8 +12,8 @@ import "./Drawer-omdZnBPG.js";
12
12
  import { p as m } from "./plugin-DRcJuXpS.js";
13
13
  import { p as u } from "./plugin-CNqL90UL.js";
14
14
  import { p as l } from "./plugin-BscWXR9h.js";
15
- import "./Form.vue_vue_type_script_setup_true_lang-O6nqLPyU.js";
16
- import { p as t } from "./plugin-BkoyYU7S.js";
15
+ import "./Form.vue_vue_type_script_setup_true_lang-Cf0LqvyX.js";
16
+ import { p as t } from "./plugin-BFAUI0U3.js";
17
17
  import { p as g } from "./plugin-DLFPglIt.js";
18
18
  import { p as a } from "./plugin-Buc7eEox.js";
19
19
  import { p as s } from "./plugin-D9k93Uu1.js";
@@ -32,15 +32,15 @@ import { p as y } from "./plugin-BN2jubTY.js";
32
32
  import { p as T } from "./plugin-CrHDShgh.js";
33
33
  import { p as S } from "./plugin-z8Hr_T_O.js";
34
34
  import { p as v } from "./plugin-Bog7k3Qf.js";
35
- import "./InputSelect.vue_vue_type_script_setup_true_lang-BlA3DIYZ.js";
36
- import { p as C } from "./plugin-Daf_swsz.js";
35
+ import "./InputSelect.vue_vue_type_script_setup_true_lang-vCtwK795.js";
36
+ import { p as C } from "./plugin-cVdTR_s6.js";
37
37
  import { p as G } from "./plugin-DT7LVAli.js";
38
38
  import { p as k } from "./plugin-Bbt6pP0l.js";
39
39
  import { p as w } from "./plugin-BQFwx3d5.js";
40
40
  import "./Link.vue_vue_type_script_setup_true_lang-DeBJ2UGi.js";
41
41
  import { p as x } from "./plugin-dL6oP11N.js";
42
42
  import { p as D } from "./plugin-BZC231Oj.js";
43
- import { p as F } from "./plugin-JFEZqDsu.js";
43
+ import { p as F } from "./plugin-BqzDqLcd.js";
44
44
  import { p as L } from "./plugin-YUomn9tF.js";
45
45
  import "./Popconfirm.vue_vue_type_script_setup_true_lang-XyjBUx0p.js";
46
46
  import { p as M } from "./plugin-Ee4Z5Rtp.js";
package/dist/plugins.js CHANGED
@@ -12,8 +12,8 @@ import "./Drawer-omdZnBPG.js";
12
12
  import { p as D } from "./plugin-DRcJuXpS.js";
13
13
  import { p as L } from "./plugin-CNqL90UL.js";
14
14
  import { p as A } from "./plugin-BscWXR9h.js";
15
- import "./Form.vue_vue_type_script_setup_true_lang-O6nqLPyU.js";
16
- import { p as E } from "./plugin-BkoyYU7S.js";
15
+ import "./Form.vue_vue_type_script_setup_true_lang-Cf0LqvyX.js";
16
+ import { p as E } from "./plugin-BFAUI0U3.js";
17
17
  import { p as j } from "./plugin-DLFPglIt.js";
18
18
  import { p as z } from "./plugin-Buc7eEox.js";
19
19
  import { p as J } from "./plugin-D9k93Uu1.js";
@@ -32,15 +32,15 @@ import { p as nr } from "./plugin-BN2jubTY.js";
32
32
  import { p as ur } from "./plugin-CrHDShgh.js";
33
33
  import { p as Pr } from "./plugin-z8Hr_T_O.js";
34
34
  import { p as gr } from "./plugin-Bog7k3Qf.js";
35
- import "./InputSelect.vue_vue_type_script_setup_true_lang-BlA3DIYZ.js";
36
- import { p as fr } from "./plugin-Daf_swsz.js";
35
+ import "./InputSelect.vue_vue_type_script_setup_true_lang-vCtwK795.js";
36
+ import { p as fr } from "./plugin-cVdTR_s6.js";
37
37
  import { p as hr } from "./plugin-DT7LVAli.js";
38
38
  import { p as Tr } from "./plugin-Bbt6pP0l.js";
39
39
  import { p as yr } from "./plugin-BQFwx3d5.js";
40
40
  import "./Link.vue_vue_type_script_setup_true_lang-DeBJ2UGi.js";
41
41
  import { p as Cr } from "./plugin-dL6oP11N.js";
42
42
  import { p as Sr } from "./plugin-BZC231Oj.js";
43
- import { p as vr } from "./plugin-JFEZqDsu.js";
43
+ import { p as vr } from "./plugin-BqzDqLcd.js";
44
44
  import { p as Dr } from "./plugin-YUomn9tF.js";
45
45
  import "./Popconfirm.vue_vue_type_script_setup_true_lang-XyjBUx0p.js";
46
46
  import { p as Lr } from "./plugin-Ee4Z5Rtp.js";
package/dist/tamandua.js CHANGED
@@ -1,4 +1,4 @@
1
- import { p as n } from "./plugins-Bc8aBhAD.js";
1
+ import { p as n } from "./plugins-DLfHiPSG.js";
2
2
  const o = {
3
3
  install(s) {
4
4
  for (const i in n)
@@ -56,7 +56,7 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
56
56
  outline: boolean;
57
57
  multiple: boolean;
58
58
  disabled: boolean;
59
- iconProps: Partial<import("../index.js").IconProps> & {
59
+ iconProps: Partial<import("../types.js").IconProps> & {
60
60
  class?: string | undefined;
61
61
  };
62
62
  }, {}>, {
@@ -1,8 +1,8 @@
1
1
  import { getCurrentInstance } from 'vue';
2
- import { SelectOption } from '../InputSelect/types.js';
2
+ import { InputSelectOption } from '../InputSelect/types.js';
3
3
 
4
4
  export type DropdownProps = {
5
- items?: SelectOption[];
5
+ items?: InputSelectOption[];
6
6
  loading?: boolean;
7
7
  multiple?: boolean;
8
8
  isVisible?: boolean;
@@ -14,7 +14,7 @@ export type DropdownProps = {
14
14
  };
15
15
  interface SelectEvent {
16
16
  index: number;
17
- option: SelectOption;
17
+ option: InputSelectOption;
18
18
  hold: boolean;
19
19
  }
20
20
  export type DropdownEvents = {
@@ -5,7 +5,6 @@ import { FormEvents } from './types.js';
5
5
 
6
6
  declare const _default: <T extends FormSchema>(__VLS_props: {
7
7
  id?: string | number | undefined;
8
- idKey?: string | undefined;
9
8
  schema?: T | undefined;
10
9
  formStyle?: {
11
10
  input?: string | undefined;
@@ -13,7 +12,7 @@ declare const _default: <T extends FormSchema>(__VLS_props: {
13
12
  } | undefined;
14
13
  showSubmit?: boolean | undefined;
15
14
  submitLabel?: string | undefined;
16
- buttonProps?: import('../index.js').ButtonProps | undefined;
15
+ buttonProps?: import('../types.js').ButtonProps | undefined;
17
16
  buttonVariant?: ButtonVariant | undefined;
18
17
  submissionFormat?: FormSubmissionFormat | undefined;
19
18
  buttonWrapperClasses?: string | undefined;
@@ -38,7 +37,6 @@ declare const _default: <T extends FormSchema>(__VLS_props: {
38
37
  }>) => void) | undefined, __VLS_setup?: Promise<{
39
38
  props: {
40
39
  id?: string | number | undefined;
41
- idKey?: string | undefined;
42
40
  schema?: T | undefined;
43
41
  formStyle?: {
44
42
  input?: string | undefined;
@@ -46,7 +44,7 @@ declare const _default: <T extends FormSchema>(__VLS_props: {
46
44
  } | undefined;
47
45
  showSubmit?: boolean | undefined;
48
46
  submitLabel?: string | undefined;
49
- buttonProps?: import('../index.js').ButtonProps | undefined;
47
+ buttonProps?: import('../types.js').ButtonProps | undefined;
50
48
  buttonVariant?: ButtonVariant | undefined;
51
49
  submissionFormat?: FormSubmissionFormat | undefined;
52
50
  buttonWrapperClasses?: string | undefined;
@@ -75,7 +73,6 @@ declare const _default: <T extends FormSchema>(__VLS_props: {
75
73
  __ctx?: {
76
74
  props: {
77
75
  id?: string | number | undefined;
78
- idKey?: string | undefined;
79
76
  schema?: T | undefined;
80
77
  formStyle?: {
81
78
  input?: string | undefined;
@@ -83,7 +80,7 @@ declare const _default: <T extends FormSchema>(__VLS_props: {
83
80
  } | undefined;
84
81
  showSubmit?: boolean | undefined;
85
82
  submitLabel?: string | undefined;
86
- buttonProps?: import('../index.js').ButtonProps | undefined;
83
+ buttonProps?: import('../types.js').ButtonProps | undefined;
87
84
  buttonVariant?: ButtonVariant | undefined;
88
85
  submissionFormat?: FormSubmissionFormat | undefined;
89
86
  buttonWrapperClasses?: string | undefined;
@@ -8,7 +8,6 @@ type FormStyle = {
8
8
  };
9
9
  export type FormProps<T extends FormSchema> = {
10
10
  id?: string | number;
11
- idKey?: string;
12
11
  schema?: T;
13
12
  formStyle?: FormStyle;
14
13
  showSubmit?: boolean;
@@ -2,4 +2,4 @@ import { default as InputPasswordPlugin } from './plugin.js';
2
2
  import { default as InputPassword } from './InputPassword.vue';
3
3
 
4
4
  export { InputPassword, InputPasswordPlugin };
5
- export type { InputPasswordProps, InputPasswordEvents } from './types.js';
5
+ export type { InputPasswordProps, InputPasswordModel, InputPasswordEvents, } from './types.js';
@@ -6,7 +6,7 @@ export type InputPasswordModel = {
6
6
  /** Strength of the password */
7
7
  strength?: number;
8
8
  /** Date of creation or last update */
9
- updatedAt?: Date;
9
+ updatedAt?: string;
10
10
  };
11
11
  export type InputPasswordProps = {
12
12
  autocomplete?: string;
@@ -2,4 +2,4 @@ import { default as InputPricePlugin } from './plugin.js';
2
2
  import { default as InputPrice } from './InputPrice.vue';
3
3
 
4
4
  export { InputPrice, InputPricePlugin };
5
- export type { InputPriceProps, InputPriceEvents } from './types.js';
5
+ export type { InputPriceModel, InputPriceProps, InputPriceEvents, } from './types.js';
@@ -1,5 +1,5 @@
1
+ import { InputSelectOption } from './types.js';
1
2
  import { APISearchFilters } from '../../types/api.js';
2
- import { SelectOption } from './types.js';
3
3
  import { Pagination } from '../../types/ui.js';
4
4
 
5
5
  declare const _default: {
@@ -30,10 +30,10 @@ export declare const Select: (args: any) => {
30
30
  }[];
31
31
  value3: import('vue').Ref<never[]>;
32
32
  search(filters?: APISearchFilters): Promise<{
33
- items: SelectOption[];
33
+ items: InputSelectOption[];
34
34
  pagination: Pagination;
35
35
  }>;
36
- mapper(book: any): SelectOption;
36
+ mapper(book: any): InputSelectOption;
37
37
  };
38
38
  template: string;
39
39
  };
@@ -1,11 +1,11 @@
1
1
  import { ElementSize, ElementPosition } from '../../enums/ui.js';
2
- import { SelectOption, InputSelectProps } from './types.js';
2
+ import { InputSelectProps, InputSelectOption } from './types.js';
3
3
 
4
4
  declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<InputSelectProps>, {
5
5
  size: ElementSize;
6
6
  options: () => never[];
7
- mapper: (i: any) => SelectOption;
8
- filter: (input: string, option: SelectOption) => boolean;
7
+ mapper: (i: any) => InputSelectOption;
8
+ filter: (input: string, option: InputSelectOption) => boolean;
9
9
  tooltip: string;
10
10
  multiple: boolean;
11
11
  placeholder: string;
@@ -22,8 +22,8 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
22
22
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<InputSelectProps>, {
23
23
  size: ElementSize;
24
24
  options: () => never[];
25
- mapper: (i: any) => SelectOption;
26
- filter: (input: string, option: SelectOption) => boolean;
25
+ mapper: (i: any) => InputSelectOption;
26
+ filter: (input: string, option: InputSelectOption) => boolean;
27
27
  tooltip: string;
28
28
  multiple: boolean;
29
29
  placeholder: string;
@@ -38,12 +38,12 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
38
38
  }>>> & {
39
39
  "onUpdate:model-value"?: ((val: any) => any) | undefined;
40
40
  }, {
41
- filter: (input: string, option: SelectOption) => boolean;
41
+ filter: (input: string, option: InputSelectOption) => boolean;
42
42
  size: ElementSize;
43
43
  multiple: boolean;
44
- options: SelectOption[];
44
+ options: InputSelectOption[];
45
45
  placeholder: string;
46
- mapper: (i: any) => SelectOption;
46
+ mapper: (i: any) => InputSelectOption;
47
47
  tooltip: string;
48
48
  isSearchable: boolean;
49
49
  dropdownPlacement: "top-start" | "top" | "top-end" | "right-start" | "right" | "right-end" | "bottom-end" | "bottom" | "bottom-start" | "left-end" | "left" | "left-start";
@@ -2,4 +2,4 @@ import { default as InputSelectPlugin } from './plugin.js';
2
2
  import { default as InputSelect } from './InputSelect.vue';
3
3
 
4
4
  export { InputSelect, InputSelectPlugin };
5
- export type { InputSelectProps, InputSelectEvents } from './types.js';
5
+ export type { InputSelectValue, InputSelectProps, InputSelectOption, InputSelectEvents, } from './types.js';
@@ -3,8 +3,8 @@ import { APISearchFilters } from '../../types/api.js';
3
3
  import { Pagination } from '../../types/ui.js';
4
4
 
5
5
  export type SelectValuePrimitives = string | number;
6
- export type SelectValue = SelectValuePrimitives | Array<SelectValuePrimitives>;
7
- export type SelectOption = {
6
+ export type InputSelectValue = SelectValuePrimitives | Array<SelectValuePrimitives>;
7
+ export type InputSelectOption = {
8
8
  /** Optional icon, to be appended to the label */
9
9
  icon?: `${Icon}`;
10
10
  /** Option label, either a string or an object containing the props necessary to render the option */
@@ -22,7 +22,7 @@ export type SelectOption = {
22
22
  action?: never;
23
23
  } | {
24
24
  /** Option value */
25
- value: SelectValue;
25
+ value: InputSelectValue;
26
26
  action?: never;
27
27
  isGroupLabel?: never;
28
28
  } | {
@@ -36,11 +36,11 @@ export type SelectOption = {
36
36
  });
37
37
  export type InputSelectProps = {
38
38
  size?: ElementSize;
39
- options?: SelectOption[];
40
- /** Mapper to convert search results to SelectOption */
41
- mapper?: (i: any) => SelectOption;
39
+ options?: InputSelectOption[];
40
+ /** Mapper to convert search results to InputSelectOption */
41
+ mapper?: (i: any) => InputSelectOption;
42
42
  /** Filter function */
43
- filter?: (input: string, option: SelectOption) => boolean;
43
+ filter?: (input: string, option: InputSelectOption) => boolean;
44
44
  tooltip?: string;
45
45
  disabled?: boolean;
46
46
  resource?: (filters?: APISearchFilters | undefined) => Promise<{
@@ -48,7 +48,7 @@ export type InputSelectProps = {
48
48
  pagination: Pagination;
49
49
  }>;
50
50
  multiple?: boolean;
51
- modelValue?: SelectValue;
51
+ modelValue?: InputSelectValue;
52
52
  placeholder?: string;
53
53
  initialValue?: any;
54
54
  /** Indicates whether the user can search the options */
@@ -21,7 +21,7 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
21
21
  onClosed?: (() => any) | undefined;
22
22
  onSaved?: (() => any) | undefined;
23
23
  }, {
24
- options: import("../InputSelect/types.js").SelectOption[];
24
+ options: import("../types.js").InputSelectOption[];
25
25
  formClass: string;
26
26
  }, {}>;
27
27
  export default _default;
@@ -1,5 +1,5 @@
1
+ import { InputSelectOption } from '../InputSelect/types.js';
1
2
  import { ComponentExposed } from 'vue-component-type-helpers';
2
- import { SelectOption } from '../InputSelect/types.js';
3
3
  import { default as Form } from '../Form/Form.vue';
4
4
 
5
5
  export type FormItem = {
@@ -10,7 +10,7 @@ export type FormItem = {
10
10
  };
11
11
  export type ModalFormProps = {
12
12
  forms: FormItem[];
13
- options?: SelectOption[];
13
+ options?: InputSelectOption[];
14
14
  formClass?: string;
15
15
  };
16
16
  export type ModalFormEvents = {
@@ -1,46 +1,45 @@
1
- import { Toast, ToastProps, ToastEvents } from './Toast/index.js';
2
- import { Tag, TagProps, TagEvents } from './Tag/index.js';
3
- import { Table, TableProps, TableEvents } from './Table/index.js';
4
- import { Tab, TabProps } from './Tab/index.js';
5
- import { Skeleton, SkeletonProps } from './Skeleton/index.js';
6
- import { SensitiveInfo, SensitiveInfoProps } from './SensitiveInfo/index.js';
7
- import { ProgressLine, ProgressLineProps } from './ProgressLine/index.js';
8
- import { ProgressCircle, ProgressCircleProps } from './ProgressCircle/index.js';
9
- import { Popover, PopoverProps } from './Popover/index.js';
10
- import { Popconfirm, PopconfirmProps, PopconfirmEvents } from './Popconfirm/index.js';
11
- import { Pagination, PaginationProps, PaginationEvents } from './Pagination/index.js';
12
- import { ModalForm, ModalFormProps, ModalFormEvents } from './ModalForm/index.js';
13
- import { Modal, ModalProps, ModalEvents } from './Modal/index.js';
14
- import { Link, LinkProps, LinkEvents } from './Link/index.js';
15
- import { InputTextarea, InputTextareaProps, InputTextareaEvents } from './InputTextarea/index.js';
16
- import { InputText, InputTextProps, InputTextEvents } from './InputText/index.js';
17
- import { InputSwitch, InputSwitchProps, InputSwitchEvents } from './InputSwitch/index.js';
18
- import { InputSelect, InputSelectProps, InputSelectEvents } from './InputSelect/index.js';
19
- import { InputRadio, InputRadioProps, InputRadioGroupProps, InputRadioGroupEvents } from './InputRadio/index.js';
20
- import { InputPrice, InputPriceProps, InputPriceEvents } from './InputPrice/index.js';
21
- import { InputPhone, InputPhoneProps, InputPhoneEvents } from './InputPhone/index.js';
22
- import { InputPassword, InputPasswordProps, InputPasswordEvents } from './InputPassword/index.js';
23
- import { InputMultiplier, InputMultiplierProps, InputMultiplierEvents } from './InputMultiplier/index.js';
24
- import { InputDate, InputDateProps, InputDateEvents } from './InputDate/index.js';
25
- import { InputColor, InputColorProps, InputColorEvents } from './InputColor/index.js';
26
- import { InputCheckbox, InputCheckboxProps, InputCheckboxEvents } from './InputCheckbox/index.js';
27
- import { InputAvatar, InputAvatarProps, InputAvatarEvents } from './InputAvatar/index.js';
28
- import { Icon, IconProps } from './Icon/index.js';
29
- import { GraphyTitle, GraphyTitleProps } from './GraphyTitle/index.js';
30
- import { GraphySubtitle, GraphySubtitleProps } from './GraphySubtitle/index.js';
31
- import { GraphyPrice, GraphyPriceProps } from './GraphyPrice/index.js';
32
- import { GraphyLabel, GraphyLabelProps } from './GraphyLabel/index.js';
33
- import { GraphyEmpty, GraphyEmptyProps } from './GraphyEmpty/index.js';
34
- import { FormItem, FormItemProps } from './FormItem/index.js';
35
- import { Form, FormProps, FormEvents } from './Form/index.js';
36
- import { FileDrop, FileDropProps, FileDropEvents } from './FileDrop/index.js';
37
- import { Dropdown, DropdownProps, DropdownEvents } from './Dropdown/index.js';
38
- import { Drawer, DrawerProps, DrawerEvents } from './Drawer/index.js';
39
- import { ChartTreemap, ChartTreemapProps } from './ChartTreemap/index.js';
40
- import { ChartLine, ChartLineProps } from './ChartLine/index.js';
41
- import { Button, ButtonProps, ButtonEvents } from './Button/index.js';
42
- import { Backdrop, BackdropProps, BackdropEvents } from './Backdrop/index.js';
43
- import { Avatar, AvatarProps } from './Avatar/index.js';
1
+ import { Toast } from './Toast/index.js';
2
+ import { Tag } from './Tag/index.js';
3
+ import { Table } from './Table/index.js';
4
+ import { Tab } from './Tab/index.js';
5
+ import { Skeleton } from './Skeleton/index.js';
6
+ import { SensitiveInfo } from './SensitiveInfo/index.js';
7
+ import { ProgressLine } from './ProgressLine/index.js';
8
+ import { ProgressCircle } from './ProgressCircle/index.js';
9
+ import { Popover } from './Popover/index.js';
10
+ import { Popconfirm } from './Popconfirm/index.js';
11
+ import { Pagination } from './Pagination/index.js';
12
+ import { ModalForm } from './ModalForm/index.js';
13
+ import { Modal } from './Modal/index.js';
14
+ import { Link } from './Link/index.js';
15
+ import { InputTextarea } from './InputTextarea/index.js';
16
+ import { InputText } from './InputText/index.js';
17
+ import { InputSwitch } from './InputSwitch/index.js';
18
+ import { InputSelect } from './InputSelect/index.js';
19
+ import { InputRadio } from './InputRadio/index.js';
20
+ import { InputPrice } from './InputPrice/index.js';
21
+ import { InputPhone } from './InputPhone/index.js';
22
+ import { InputPassword } from './InputPassword/index.js';
23
+ import { InputMultiplier } from './InputMultiplier/index.js';
24
+ import { InputDate } from './InputDate/index.js';
25
+ import { InputColor } from './InputColor/index.js';
26
+ import { InputCheckbox } from './InputCheckbox/index.js';
27
+ import { InputAvatar } from './InputAvatar/index.js';
28
+ import { Icon } from './Icon/index.js';
29
+ import { GraphyTitle } from './GraphyTitle/index.js';
30
+ import { GraphySubtitle } from './GraphySubtitle/index.js';
31
+ import { GraphyPrice } from './GraphyPrice/index.js';
32
+ import { GraphyLabel } from './GraphyLabel/index.js';
33
+ import { GraphyEmpty } from './GraphyEmpty/index.js';
34
+ import { FormItem } from './FormItem/index.js';
35
+ import { Form } from './Form/index.js';
36
+ import { FileDrop } from './FileDrop/index.js';
37
+ import { Dropdown } from './Dropdown/index.js';
38
+ import { Drawer } from './Drawer/index.js';
39
+ import { ChartTreemap } from './ChartTreemap/index.js';
40
+ import { ChartLine } from './ChartLine/index.js';
41
+ import { Button } from './Button/index.js';
42
+ import { Backdrop } from './Backdrop/index.js';
43
+ import { Avatar } from './Avatar/index.js';
44
44
 
45
45
  export { Avatar, Backdrop, Button, ChartLine, ChartTreemap, Drawer, Dropdown, FileDrop, Form, FormItem, GraphyEmpty, GraphyLabel, GraphyPrice, GraphySubtitle, GraphyTitle, Icon, InputAvatar, InputCheckbox, InputColor, InputDate, InputMultiplier, InputPassword, InputPhone, InputPrice, InputRadio, InputSelect, InputSwitch, InputText, InputTextarea, Link, Modal, ModalForm, Pagination, Popconfirm, Popover, ProgressCircle, ProgressLine, SensitiveInfo, Skeleton, Tab, Table, Tag, Toast, };
46
- export type { AvatarProps, BackdropProps, BackdropEvents, ButtonProps, ButtonEvents, ChartLineProps, ChartTreemapProps, DrawerProps, DrawerEvents, DropdownProps, DropdownEvents, FileDropProps, FileDropEvents, FormProps, FormEvents, FormItemProps, GraphyEmptyProps, GraphyLabelProps, GraphyPriceProps, GraphySubtitleProps, GraphyTitleProps, IconProps, InputAvatarProps, InputAvatarEvents, InputCheckboxProps, InputCheckboxEvents, InputColorProps, InputColorEvents, InputDateProps, InputDateEvents, InputMultiplierEvents, InputPasswordProps, InputPasswordEvents, InputPhoneProps, InputPhoneEvents, InputPriceProps, InputPriceEvents, InputRadioProps, InputRadioGroupProps, InputRadioGroupEvents, InputSelectProps, InputSelectEvents, InputSwitchProps, InputSwitchEvents, InputMultiplierProps, InputTextProps, InputTextEvents, InputTextareaProps, InputTextareaEvents, LinkProps, LinkEvents, ModalProps, ModalEvents, ModalFormProps, ModalFormEvents, PaginationProps, PaginationEvents, PopconfirmProps, PopconfirmEvents, PopoverProps, ProgressCircleProps, ProgressLineProps, SensitiveInfoProps, SkeletonProps, TabProps, TableProps, TableEvents, TagEvents, TagProps, ToastProps, ToastEvents, };
@@ -0,0 +1,45 @@
1
+ import { ToastProps, ToastEvents } from './Toast/index.js';
2
+ import { TagProps, TagEvents } from './Tag/index.js';
3
+ import { TableProps, TableEvents } from './Table/index.js';
4
+ import { TabProps } from './Tab/index.js';
5
+ import { SkeletonProps } from './Skeleton/index.js';
6
+ import { SensitiveInfoProps } from './SensitiveInfo/index.js';
7
+ import { ProgressLineProps } from './ProgressLine/index.js';
8
+ import { ProgressCircleProps } from './ProgressCircle/index.js';
9
+ import { PopoverProps } from './Popover/index.js';
10
+ import { PopconfirmProps, PopconfirmEvents } from './Popconfirm/index.js';
11
+ import { PaginationProps, PaginationEvents } from './Pagination/index.js';
12
+ import { ModalFormProps, ModalFormEvents } from './ModalForm/index.js';
13
+ import { ModalProps, ModalEvents } from './Modal/index.js';
14
+ import { LinkProps, LinkEvents } from './Link/index.js';
15
+ import { InputTextareaProps, InputTextareaEvents } from './InputTextarea/index.js';
16
+ import { InputTextProps, InputTextEvents } from './InputText/index.js';
17
+ import { InputSwitchProps, InputSwitchEvents } from './InputSwitch/index.js';
18
+ import { InputSelectValue, InputSelectProps, InputSelectOption, InputSelectEvents } from './InputSelect/index.js';
19
+ import { InputRadioProps, InputRadioGroupProps, InputRadioGroupEvents } from './InputRadio/index.js';
20
+ import { InputPriceModel, InputPriceProps, InputPriceEvents } from './InputPrice/index.js';
21
+ import { InputPhoneProps, InputPhoneEvents } from './InputPhone/index.js';
22
+ import { InputPasswordModel, InputPasswordProps, InputPasswordEvents } from './InputPassword/index.js';
23
+ import { InputMultiplierProps, InputMultiplierEvents } from './InputMultiplier/index.js';
24
+ import { InputDateProps, InputDateEvents } from './InputDate/index.js';
25
+ import { InputColorProps, InputColorEvents } from './InputColor/index.js';
26
+ import { InputCheckboxProps, InputCheckboxEvents } from './InputCheckbox/index.js';
27
+ import { InputAvatarProps, InputAvatarEvents } from './InputAvatar/index.js';
28
+ import { IconProps } from './Icon/index.js';
29
+ import { GraphyTitleProps } from './GraphyTitle/index.js';
30
+ import { GraphySubtitleProps } from './GraphySubtitle/index.js';
31
+ import { GraphyPriceProps } from './GraphyPrice/index.js';
32
+ import { GraphyLabelProps } from './GraphyLabel/index.js';
33
+ import { GraphyEmptyProps } from './GraphyEmpty/index.js';
34
+ import { FormItemProps } from './FormItem/index.js';
35
+ import { FormProps, FormEvents } from './Form/index.js';
36
+ import { FileDropProps, FileDropEvents } from './FileDrop/index.js';
37
+ import { DropdownProps, DropdownEvents } from './Dropdown/index.js';
38
+ import { DrawerProps, DrawerEvents } from './Drawer/index.js';
39
+ import { ChartTreemapProps } from './ChartTreemap/index.js';
40
+ import { ChartLineProps } from './ChartLine/index.js';
41
+ import { ButtonProps, ButtonEvents } from './Button/index.js';
42
+ import { BackdropProps, BackdropEvents } from './Backdrop/index.js';
43
+ import { AvatarProps } from './Avatar/index.js';
44
+
45
+ export type { AvatarProps, BackdropProps, BackdropEvents, ButtonProps, ButtonEvents, ChartLineProps, ChartTreemapProps, DrawerProps, DrawerEvents, DropdownProps, DropdownEvents, FileDropProps, FileDropEvents, FormProps, FormEvents, FormItemProps, GraphyEmptyProps, GraphyLabelProps, GraphyPriceProps, GraphySubtitleProps, GraphyTitleProps, IconProps, InputAvatarProps, InputAvatarEvents, InputCheckboxProps, InputCheckboxEvents, InputColorProps, InputColorEvents, InputDateProps, InputDateEvents, InputMultiplierEvents, InputPasswordModel, InputPasswordProps, InputPasswordEvents, InputPhoneProps, InputPhoneEvents, InputPriceModel, InputPriceProps, InputPriceEvents, InputRadioProps, InputRadioGroupProps, InputRadioGroupEvents, InputSelectValue, InputSelectProps, InputSelectOption, InputSelectEvents, InputSwitchProps, InputSwitchEvents, InputMultiplierProps, InputTextProps, InputTextEvents, InputTextareaProps, InputTextareaEvents, LinkProps, LinkEvents, ModalProps, ModalEvents, ModalFormProps, ModalFormEvents, PaginationProps, PaginationEvents, PopconfirmProps, PopconfirmEvents, PopoverProps, ProgressCircleProps, ProgressLineProps, SensitiveInfoProps, SkeletonProps, TabProps, TableProps, TableEvents, TagEvents, TagProps, ToastProps, ToastEvents, };
@@ -13,7 +13,7 @@ export default class CrudService {
13
13
  };
14
14
  isLoading: boolean;
15
15
  formReference: ComponentExposed<typeof ModalForm> | undefined;
16
- constructor(entity: string, formReference: ComponentExposed<typeof ModalForm>);
16
+ constructor(entity: string, formReference: any);
17
17
  get isEditing(): boolean;
18
18
  get isCreating(): boolean;
19
19
  show(state?: FormStates): void;
@@ -3,8 +3,7 @@ import { FormSchema, FormInstance } from '../types/form.js';
3
3
  import { Ref, UnwrapNestedRefs } from 'vue';
4
4
 
5
5
  export default function useForm<TSchema extends FormSchema = FormSchema>(options: {
6
- id?: Ref<string | number>;
7
- idKey?: string;
6
+ id?: Ref<string | number | undefined>;
8
7
  schema: TSchema;
9
8
  format?: FormSubmissionFormat;
10
9
  }): {
@@ -3,3 +3,4 @@ export * from './api.js';
3
3
  export * from './form.js';
4
4
  export * from './ui.js';
5
5
  export * from './website.js';
6
+ export * from '../components/types.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caipira/tamandua",
3
- "version": "0.0.34",
3
+ "version": "0.0.36",
4
4
  "private": false,
5
5
  "description": "UI library for the Caipira ecosystem",
6
6
  "license": "GPL-3.0-only",
@@ -114,4 +114,4 @@
114
114
  "vue": "^3.4.21",
115
115
  "vue-tsc": "^2.0.13"
116
116
  }
117
- }
117
+ }
@@ -1,205 +0,0 @@
1
- import { reactive as C, defineComponent as A, ref as y, watch as P, provide as _, resolveComponent as T, openBlock as N, createElementBlock as O, renderSlot as B, unref as J, createElementVNode as E, normalizeClass as R, withDirectives as W, createVNode as j, mergeProps as K, vShow as M } from "vue";
2
- import { B as z } from "./ui-BC6H9E93.js";
3
- import { F as s, a as p } from "./form-BkXpIJ0e.js";
4
- import { f as L } from "./index-CjvqeRf7.js";
5
- const w = (t) => t ? L(t, "yyyy-MM-dd") : "", F = (t) => [`${t?.iso}`, `${t?.value}`], h = (t) => t?.iso2 ?? "", S = async (t) => t?.hash ? t.hash : t?.raw ?? "", i = {
6
- default: (t, e, r) => (e[r] = t, e),
7
- price: (t, e, r, n = ["Currency", "Value"]) => {
8
- const [u, a] = F(t);
9
- return e[`${r}${n[0]}`] = u, e[`${r}${n[1]}`] = a, e;
10
- },
11
- password: async (t, e, r) => (e[r] = await S(t), e),
12
- stringArray: (t, e, r) => (e[r] = t, e)
13
- }, I = async (t, e, r, n) => {
14
- switch (t) {
15
- case s.Country:
16
- return i.default(
17
- h(r),
18
- e,
19
- n
20
- );
21
- case s.Documents:
22
- return i.default(r, e, n);
23
- case s.Date:
24
- return i.default(
25
- w(r),
26
- e,
27
- n
28
- );
29
- case s.Address:
30
- return i.default(r, e, n);
31
- case s.Price:
32
- return i.price(r, e, n);
33
- case s.Password:
34
- return await i.password(r, e, n);
35
- case s.StringArray:
36
- return i.stringArray(r, e, n);
37
- default:
38
- return i.default(r, e, n);
39
- }
40
- }, f = (t) => (t == null ? t = "" : typeof t == "object" ? t = JSON.stringify(t) : typeof t == "number" ? t = t.toString() : typeof t == "boolean" && (t = t ? "1" : "0"), t), c = {
41
- default: (t, e, r) => {
42
- const n = f(t);
43
- return t && e.append(r, n), e;
44
- },
45
- price: (t, e, r, n = ["Currency", "Value"]) => {
46
- const [u, a] = F(t);
47
- return e.append(`${r}${n[0]}`, f(u)), e.append(`${r}${n[1]}`, f(a)), e;
48
- },
49
- address: (t, e, r) => (e.append(
50
- r,
51
- JSON.stringify({
52
- ...t,
53
- country: h(t?.country)
54
- })
55
- ), e),
56
- documents: (t, e, r) => (r.endsWith("[]") || (r = `${r}[]`), Array.from(t).forEach((n) => e.append(r, n)), e),
57
- document: (t, e, r) => (e.append(r, t), e),
58
- stringArray: (t, e, r) => (r.endsWith("[]") || (r = `${r}[]`), t.forEach((n) => e.append(r, f(n))), e)
59
- }, Y = async (t, e, r, n) => {
60
- switch (t) {
61
- case s.Country:
62
- return c.default(
63
- h(r),
64
- e,
65
- n
66
- );
67
- case s.Document:
68
- return c.document(r, e, n);
69
- case s.Documents:
70
- return c.documents(r, e, n);
71
- case s.Date:
72
- return c.default(
73
- w(r),
74
- e,
75
- n
76
- );
77
- case s.Address:
78
- return c.address(r, e, n);
79
- case s.Price:
80
- return c.price(r, e, n);
81
- case s.Password:
82
- return c.default(
83
- await S(r),
84
- e,
85
- n
86
- );
87
- case s.StringArray:
88
- return c.stringArray(r, e, n);
89
- default:
90
- return c.default(r, e, n);
91
- }
92
- }, q = async (t, e, r) => {
93
- switch (r) {
94
- case p.JSON:
95
- let n = {};
96
- for (const a in t)
97
- n = await I(
98
- e[a],
99
- n,
100
- t[a],
101
- a
102
- );
103
- return n;
104
- case p.FormData:
105
- default:
106
- let u = new FormData();
107
- for (const a in t)
108
- u = await Y(
109
- e[a],
110
- u,
111
- t[a],
112
- a
113
- );
114
- return u;
115
- }
116
- };
117
- function x(t) {
118
- const e = C(
119
- {}
120
- );
121
- return { form: e, setValue: (o, d) => {
122
- e[o] = d;
123
- }, setValues: (o) => {
124
- for (const [d, b] of Object.entries(o))
125
- e[d] = b;
126
- }, getValue: (o) => e[o], reset: () => {
127
- for (const o in e)
128
- delete e[o];
129
- }, submit: async () => {
130
- const o = {
131
- ...e
132
- };
133
- return t?.id?.value && (o.id = t.id.value), {
134
- isValid: !0,
135
- form: await q(
136
- o,
137
- t.schema,
138
- t.format ?? p.JSON
139
- )
140
- };
141
- } };
142
- }
143
- const Z = /* @__PURE__ */ A({
144
- name: "TForm",
145
- __name: "Form",
146
- props: {
147
- id: { default: "" },
148
- idKey: { default: "id" },
149
- schema: { default: () => ({}) },
150
- formStyle: { default: () => ({}) },
151
- showSubmit: { type: Boolean, default: !1 },
152
- submitLabel: { default: "Submit" },
153
- buttonProps: {},
154
- buttonVariant: { default: z.PRIMARY },
155
- submissionFormat: { default: p.FormData },
156
- buttonWrapperClasses: { default: "" }
157
- },
158
- emits: ["submit", "change"],
159
- setup(t, { expose: e, emit: r }) {
160
- const n = t, u = r, a = y(), { form: l, getValue: o, setValue: d, setValues: b, reset: g, submit: $ } = x({
161
- id: y(n.id),
162
- idKey: n.idKey,
163
- schema: n.schema,
164
- format: n.submissionFormat
165
- }), V = async () => {
166
- const m = await $();
167
- return u("submit", m), m;
168
- };
169
- return P(l, (m) => {
170
- u("change", m);
171
- }), _("formStyle", n.formStyle), e({
172
- submit: V,
173
- reset: g,
174
- setValues: b,
175
- form: l,
176
- setValue: d,
177
- getValue: o
178
- }), (m, G) => {
179
- const D = T("t-button");
180
- return N(), O("form", {
181
- onSubmit: V,
182
- ref_key: "formReference",
183
- ref: a
184
- }, [
185
- B(m.$slots, "default", { form: J(l) }),
186
- E("div", {
187
- class: R([n.buttonWrapperClasses])
188
- }, [
189
- W(j(D, K(n.buttonProps, {
190
- type: "submit",
191
- class: "mt-4",
192
- variant: n.buttonVariant,
193
- label: n.submitLabel,
194
- onClick: V
195
- }), null, 16, ["variant", "label"]), [
196
- [M, n.showSubmit]
197
- ])
198
- ], 2)
199
- ], 544);
200
- };
201
- }
202
- });
203
- export {
204
- Z as _
205
- };