@caipira/tamandua 0.0.35 → 0.0.37
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.
- package/dist/Form.js +2 -2
- package/dist/Form.vue_vue_type_script_setup_true_lang-Cf0LqvyX.js +203 -0
- package/dist/components.js +1 -1
- package/dist/{plugin-BkoyYU7S.js → plugin-BFAUI0U3.js} +1 -1
- package/dist/{plugins-MQbI25Au.js → plugins-DLfHiPSG.js} +2 -2
- package/dist/plugins.js +2 -2
- package/dist/tamandua.js +1 -1
- package/dist/types/components/Button/Button.vue.d.ts +1 -1
- package/dist/types/components/Form/Form.vue.d.ts +3 -6
- package/dist/types/components/Form/types.d.ts +0 -1
- package/dist/types/components/InputPassword/types.d.ts +1 -1
- package/dist/types/components/ModalForm/ModalForm.vue.d.ts +1 -1
- package/dist/types/components/index.d.ts +43 -44
- package/dist/types/components/types.d.ts +45 -0
- package/dist/types/{composables → form}/useForm.d.ts +1 -2
- package/dist/types/index.d.ts +1 -5
- package/dist/types/types/index.d.ts +1 -0
- package/package.json +1 -1
- package/dist/Form.vue_vue_type_script_setup_true_lang-O6nqLPyU.js +0 -205
- /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-
|
|
2
|
-
import { p as a } from "./plugin-
|
|
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
|
+
};
|
package/dist/components.js
CHANGED
|
@@ -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-
|
|
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";
|
|
@@ -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-
|
|
16
|
-
import { p as t } from "./plugin-
|
|
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";
|
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-
|
|
16
|
-
import { p as E } from "./plugin-
|
|
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";
|
package/dist/tamandua.js
CHANGED
|
@@ -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("../
|
|
59
|
+
iconProps: Partial<import("../types.js").IconProps> & {
|
|
60
60
|
class?: string | undefined;
|
|
61
61
|
};
|
|
62
62
|
}, {}>, {
|
|
@@ -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('../
|
|
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('../
|
|
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('../
|
|
83
|
+
buttonProps?: import('../types.js').ButtonProps | undefined;
|
|
87
84
|
buttonVariant?: ButtonVariant | undefined;
|
|
88
85
|
submissionFormat?: FormSubmissionFormat | undefined;
|
|
89
86
|
buttonWrapperClasses?: string | undefined;
|
|
@@ -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("../
|
|
24
|
+
options: import("../types.js").InputSelectOption[];
|
|
25
25
|
formClass: string;
|
|
26
26
|
}, {}>;
|
|
27
27
|
export default _default;
|
|
@@ -1,46 +1,45 @@
|
|
|
1
|
-
import { Toast
|
|
2
|
-
import { Tag
|
|
3
|
-
import { Table
|
|
4
|
-
import { Tab
|
|
5
|
-
import { Skeleton
|
|
6
|
-
import { SensitiveInfo
|
|
7
|
-
import { ProgressLine
|
|
8
|
-
import { ProgressCircle
|
|
9
|
-
import { Popover
|
|
10
|
-
import { Popconfirm
|
|
11
|
-
import { Pagination
|
|
12
|
-
import { ModalForm
|
|
13
|
-
import { Modal
|
|
14
|
-
import { Link
|
|
15
|
-
import { InputTextarea
|
|
16
|
-
import { InputText
|
|
17
|
-
import { InputSwitch
|
|
18
|
-
import { InputSelect
|
|
19
|
-
import { InputRadio
|
|
20
|
-
import { InputPrice
|
|
21
|
-
import { InputPhone
|
|
22
|
-
import { InputPassword
|
|
23
|
-
import { InputMultiplier
|
|
24
|
-
import { InputDate
|
|
25
|
-
import { InputColor
|
|
26
|
-
import { InputCheckbox
|
|
27
|
-
import { InputAvatar
|
|
28
|
-
import { Icon
|
|
29
|
-
import { GraphyTitle
|
|
30
|
-
import { GraphySubtitle
|
|
31
|
-
import { GraphyPrice
|
|
32
|
-
import { GraphyLabel
|
|
33
|
-
import { GraphyEmpty
|
|
34
|
-
import { FormItem
|
|
35
|
-
import { Form
|
|
36
|
-
import { FileDrop
|
|
37
|
-
import { Dropdown
|
|
38
|
-
import { Drawer
|
|
39
|
-
import { ChartTreemap
|
|
40
|
-
import { ChartLine
|
|
41
|
-
import { Button
|
|
42
|
-
import { Backdrop
|
|
43
|
-
import { Avatar
|
|
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, 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, };
|
|
@@ -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, };
|
|
@@ -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
|
}): {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { Plugin } from 'vue';
|
|
2
2
|
|
|
3
3
|
declare const plugin: Plugin;
|
|
4
|
-
export type * from './types/
|
|
5
|
-
export type * from './types/api.js';
|
|
6
|
-
export type * from './types/form.js';
|
|
7
|
-
export type * from './types/ui.js';
|
|
8
|
-
export type * from './types/website.js';
|
|
4
|
+
export type * from './types/index.js';
|
|
9
5
|
export default plugin;
|
package/package.json
CHANGED
|
@@ -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
|
-
};
|
|
File without changes
|