vlite3 0.1.10 → 0.2.2
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/README.md +226 -150
- package/components/Button.vue.js +1 -1
- package/components/Chip/Chip.vue.js +15 -15
- package/components/DataTable/DataTable.vue.js +2 -2
- package/components/DataTable/DataTable.vue2.js +41 -39
- package/components/DataTable/types.d.ts +1 -0
- package/components/DatePicker.vue.d.ts +12 -3
- package/components/DatePicker.vue.js +80 -39
- package/components/Dropdown/DropdownMenu.vue.js +48 -47
- package/components/Form/Form.vue.d.ts +2 -0
- package/components/Form/Form.vue.js +2 -2
- package/components/Form/Form.vue2.js +104 -101
- package/components/Form/FormField.vue.d.ts +4 -0
- package/components/Form/FormField.vue.js +248 -148
- package/components/Form/FormFields.vue.d.ts +2 -0
- package/components/Form/FormFields.vue.js +2 -2
- package/components/Form/FormFields.vue2.js +45 -39
- package/components/Form/types.d.ts +24 -4
- package/components/Form/utils/form.utils.d.ts +5 -1
- package/components/Form/utils/form.utils.js +69 -60
- package/components/GoogleLogin.vue.d.ts +41 -0
- package/components/GoogleLogin.vue.js +60 -0
- package/components/GoogleLogin.vue2.js +4 -0
- package/components/Input.vue.js +120 -111
- package/components/NumberInput.vue.d.ts +38 -0
- package/components/NumberInput.vue.js +7 -0
- package/components/NumberInput.vue2.js +191 -0
- package/components/Pagination/Pagination.vue.d.ts +1 -0
- package/components/Pagination/Pagination.vue.js +60 -46
- package/components/ProgressBar/ProgressBar.vue.d.ts +12 -0
- package/components/ProgressBar/ProgressBar.vue.js +7 -0
- package/components/ProgressBar/ProgressBar.vue2.js +158 -0
- package/components/ProgressBar/index.d.ts +3 -0
- package/components/Spinner/Spinner.vue.d.ts +8 -0
- package/components/Spinner/Spinner.vue.js +89 -0
- package/components/Spinner/Spinner.vue2.js +4 -0
- package/components/Spinner/index.d.ts +2 -0
- package/components/Spinner/types.d.ts +9 -0
- package/components/Tabes/Tabes.vue.d.ts +3 -1
- package/components/Tabes/Tabes.vue.js +103 -44
- package/directives/vScrollReveal.d.ts +2 -0
- package/directives/vScrollReveal.js +48 -0
- package/index.d.ts +8 -0
- package/index.js +180 -147
- package/package.json +6 -3
- package/style.css +56 -4
- package/types/form.type.d.ts +2 -2
- package/types/progressbar.d.ts +75 -0
- package/utils/env.d.ts +14 -0
- package/utils/env.js +4 -0
- package/utils/functions.d.ts +99 -0
- package/utils/functions.js +91 -7
- package/utils/index.d.ts +2 -0
- package/utils/search.util.d.ts +127 -0
- package/utils/search.util.js +363 -0
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { isComponent as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
1
|
+
import { defineComponent as T, defineAsyncComponent as f, computed as n, markRaw as j, openBlock as r, createBlock as u, mergeProps as s, toHandlers as C, createSlots as E, unref as L, withCtx as o, createVNode as S, createTextVNode as m, toDisplayString as p, createCommentVNode as A, resolveDynamicComponent as H } from "vue";
|
|
2
|
+
import { isComponent as g, isAddonObject as v } from "./utils/form.utils.js";
|
|
3
|
+
import M from "../NumberInput.vue.js";
|
|
4
|
+
import h from "../Button.vue.js";
|
|
5
|
+
import y from "../Input.vue.js";
|
|
6
|
+
import q from "../Switch.vue.js";
|
|
7
|
+
import G from "../CheckBox.vue.js";
|
|
8
|
+
import J from "../Textarea.vue.js";
|
|
9
|
+
import K from "../FilePicker/FilePicker.vue.js";
|
|
10
|
+
import Q from "../AvatarUploader/AvatarUploader.vue.js";
|
|
11
|
+
import k from "../Dropdown/Dropdown.vue.js";
|
|
12
|
+
const oe = /* @__PURE__ */ T({
|
|
11
13
|
__name: "FormField",
|
|
12
14
|
props: {
|
|
13
15
|
field: {},
|
|
@@ -21,179 +23,277 @@ const O = /* @__PURE__ */ b({
|
|
|
21
23
|
error: { default: "" },
|
|
22
24
|
isUpdate: { type: Boolean, default: !1 }
|
|
23
25
|
},
|
|
24
|
-
emits: ["change"],
|
|
25
|
-
setup(
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
33
|
-
return
|
|
34
|
-
switch (
|
|
26
|
+
emits: ["change", "addonChange", "addonAction"],
|
|
27
|
+
setup(a, { emit: w }) {
|
|
28
|
+
const z = f(() => import("../MultiSelect/MultiSelect.vue2.js")), $ = f(() => import("../DatePicker.vue2.js")), P = f(() => import("../ColorPicker/ColorPicker.vue2.js")), U = f(() => import("../IconPicker.vue2.js")), F = f(() => import("./CustomFields.vue.js")), e = a, c = w, d = (t, l) => {
|
|
29
|
+
c("change", { value: t, data: l });
|
|
30
|
+
}, N = (t) => {
|
|
31
|
+
c("change", { value: t });
|
|
32
|
+
}, B = n(() => {
|
|
33
|
+
const t = e.field.type;
|
|
34
|
+
if (g(t))
|
|
35
|
+
return j(t);
|
|
36
|
+
switch (t) {
|
|
35
37
|
case "text":
|
|
36
38
|
case "email":
|
|
37
39
|
case "password":
|
|
38
|
-
case "number":
|
|
39
40
|
case "tel":
|
|
40
41
|
case "url":
|
|
41
42
|
case "search":
|
|
42
|
-
return
|
|
43
|
+
return y;
|
|
44
|
+
case "number":
|
|
45
|
+
return M;
|
|
43
46
|
case "textarea":
|
|
44
|
-
return
|
|
47
|
+
return J;
|
|
45
48
|
case "switch":
|
|
46
|
-
return
|
|
49
|
+
return q;
|
|
47
50
|
case "check":
|
|
48
|
-
return
|
|
51
|
+
return G;
|
|
49
52
|
case "select":
|
|
50
|
-
return
|
|
53
|
+
return k;
|
|
51
54
|
case "multiSelect":
|
|
52
|
-
return
|
|
55
|
+
return z;
|
|
53
56
|
case "date":
|
|
54
57
|
case "time":
|
|
55
|
-
return
|
|
58
|
+
return $;
|
|
56
59
|
case "file":
|
|
57
60
|
case "fileUploader":
|
|
58
|
-
return
|
|
61
|
+
return K;
|
|
59
62
|
case "avatarUpload":
|
|
60
|
-
return
|
|
63
|
+
return Q;
|
|
61
64
|
case "color":
|
|
62
|
-
return
|
|
65
|
+
return P;
|
|
63
66
|
case "iconPicker":
|
|
64
|
-
return
|
|
67
|
+
return U;
|
|
65
68
|
case "customFields":
|
|
66
|
-
return
|
|
69
|
+
return F;
|
|
67
70
|
default:
|
|
68
|
-
return
|
|
71
|
+
return y;
|
|
69
72
|
}
|
|
70
|
-
}),
|
|
71
|
-
const
|
|
72
|
-
disabled:
|
|
73
|
-
...
|
|
73
|
+
}), V = n(() => {
|
|
74
|
+
const t = e.field.type, l = {
|
|
75
|
+
disabled: e.disabled || e.field.disabled === !0,
|
|
76
|
+
...e.field.props || {}
|
|
74
77
|
};
|
|
75
|
-
return
|
|
76
|
-
...
|
|
77
|
-
modelValue:
|
|
78
|
-
type:
|
|
79
|
-
placeholder:
|
|
80
|
-
icon:
|
|
81
|
-
iconRight:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
78
|
+
return t === "text" || t === "email" || t === "password" || t === "tel" || t === "url" || t === "search" || !t ? {
|
|
79
|
+
...l,
|
|
80
|
+
modelValue: e.value ?? "",
|
|
81
|
+
type: t || "text",
|
|
82
|
+
placeholder: e.field.placeholder,
|
|
83
|
+
icon: e.field.icon,
|
|
84
|
+
iconRight: e.field.iconRight,
|
|
85
|
+
// Only pass addon strings; object addons are rendered via slots
|
|
86
|
+
addonLeft: typeof e.field.addonLeft == "string" ? e.field.addonLeft : void 0,
|
|
87
|
+
addonRight: typeof e.field.addonRight == "string" ? e.field.addonRight : void 0,
|
|
88
|
+
variant: e.variant,
|
|
89
|
+
size: e.size,
|
|
90
|
+
rounded: e.rounded,
|
|
91
|
+
error: e.error,
|
|
92
|
+
min: e.field.min,
|
|
93
|
+
// kept for validation attributes if needed
|
|
94
|
+
max: e.field.max,
|
|
95
|
+
class: e.field.className
|
|
96
|
+
} : t === "number" ? {
|
|
97
|
+
...l,
|
|
98
|
+
modelValue: e.value ?? void 0,
|
|
99
|
+
min: e.field.min,
|
|
100
|
+
max: e.field.max,
|
|
101
|
+
step: e.field.props?.step ?? 1,
|
|
102
|
+
variant: e.field.props?.variant ?? "split",
|
|
103
|
+
mode: e.field.props?.mode ?? "outline",
|
|
104
|
+
size: e.size,
|
|
105
|
+
rounded: e.rounded,
|
|
106
|
+
placeholder: e.field.placeholder,
|
|
107
|
+
class: e.field.className
|
|
108
|
+
} : t === "textarea" ? {
|
|
109
|
+
...l,
|
|
110
|
+
modelValue: e.value ?? "",
|
|
111
|
+
placeholder: e.field.placeholder,
|
|
112
|
+
rows: e.field.props?.rows || 3,
|
|
113
|
+
class: e.field.className
|
|
114
|
+
} : t === "switch" ? {
|
|
115
|
+
...l,
|
|
116
|
+
modelValue: !!e.value,
|
|
100
117
|
label: ""
|
|
101
118
|
// Label handled externally
|
|
102
|
-
} :
|
|
103
|
-
...
|
|
104
|
-
modelValue: !!
|
|
119
|
+
} : t === "check" ? {
|
|
120
|
+
...l,
|
|
121
|
+
modelValue: !!e.value,
|
|
105
122
|
label: ""
|
|
106
123
|
// Label handled externally
|
|
107
|
-
} :
|
|
108
|
-
...
|
|
109
|
-
modelValue:
|
|
110
|
-
options:
|
|
111
|
-
placeholder:
|
|
124
|
+
} : t === "select" ? {
|
|
125
|
+
...l,
|
|
126
|
+
modelValue: e.value,
|
|
127
|
+
options: e.field.options || [],
|
|
128
|
+
placeholder: e.field.placeholder,
|
|
112
129
|
selectable: !0,
|
|
113
130
|
closeOnSelect: !0
|
|
114
|
-
} :
|
|
115
|
-
...
|
|
116
|
-
modelValue: Array.isArray(
|
|
117
|
-
options:
|
|
118
|
-
placeholder:
|
|
119
|
-
} :
|
|
120
|
-
...
|
|
121
|
-
modelValue:
|
|
122
|
-
mode:
|
|
123
|
-
placeholder:
|
|
124
|
-
} :
|
|
125
|
-
...
|
|
126
|
-
modelValue:
|
|
127
|
-
multiSelect:
|
|
128
|
-
fileTypes:
|
|
131
|
+
} : t === "multiSelect" ? {
|
|
132
|
+
...l,
|
|
133
|
+
modelValue: Array.isArray(e.value) ? e.value : [],
|
|
134
|
+
options: e.field.options || [],
|
|
135
|
+
placeholder: e.field.placeholder
|
|
136
|
+
} : t === "date" || t === "time" ? {
|
|
137
|
+
...l,
|
|
138
|
+
modelValue: e.value,
|
|
139
|
+
mode: t === "time" ? "time" : "date",
|
|
140
|
+
placeholder: e.field.placeholder
|
|
141
|
+
} : t === "fileUploader" || t === "file" ? {
|
|
142
|
+
...l,
|
|
143
|
+
modelValue: e.value,
|
|
144
|
+
multiSelect: e.field.props?.multiple || !1,
|
|
145
|
+
fileTypes: e.field.props?.accept ? e.field.props.accept.split(",") : [],
|
|
129
146
|
returnFormat: "base64",
|
|
130
|
-
variant:
|
|
131
|
-
placeholder:
|
|
132
|
-
size:
|
|
133
|
-
rounded:
|
|
134
|
-
} :
|
|
135
|
-
...
|
|
136
|
-
modelValue:
|
|
137
|
-
editable: !
|
|
138
|
-
} :
|
|
139
|
-
...
|
|
140
|
-
modelValue:
|
|
141
|
-
} :
|
|
142
|
-
...
|
|
143
|
-
value:
|
|
144
|
-
} :
|
|
145
|
-
...
|
|
146
|
-
modelValue: Array.isArray(
|
|
147
|
-
schema:
|
|
148
|
-
headers:
|
|
149
|
-
values:
|
|
150
|
-
variant:
|
|
151
|
-
size:
|
|
152
|
-
rounded:
|
|
153
|
-
isUpdate:
|
|
154
|
-
} :
|
|
155
|
-
...
|
|
156
|
-
value:
|
|
157
|
-
values:
|
|
158
|
-
} :
|
|
159
|
-
}),
|
|
160
|
-
const
|
|
161
|
-
return
|
|
162
|
-
"update:modelValue":
|
|
163
|
-
} :
|
|
164
|
-
onSelect: (
|
|
165
|
-
l
|
|
147
|
+
variant: t === "file" ? "input" : "dropzone",
|
|
148
|
+
placeholder: e.field.placeholder,
|
|
149
|
+
size: e.size,
|
|
150
|
+
rounded: e.rounded
|
|
151
|
+
} : t === "avatarUpload" ? {
|
|
152
|
+
...l,
|
|
153
|
+
modelValue: e.value,
|
|
154
|
+
editable: !e.readonly
|
|
155
|
+
} : t === "color" ? {
|
|
156
|
+
...l,
|
|
157
|
+
modelValue: e.value || "#000000"
|
|
158
|
+
} : t === "iconPicker" ? {
|
|
159
|
+
...l,
|
|
160
|
+
value: e.value || "lucide:smile"
|
|
161
|
+
} : t === "customFields" ? {
|
|
162
|
+
...l,
|
|
163
|
+
modelValue: Array.isArray(e.value) ? e.value : [],
|
|
164
|
+
schema: e.field.props?.schema || [],
|
|
165
|
+
headers: e.field.props?.headers || [],
|
|
166
|
+
values: e.values,
|
|
167
|
+
variant: e.variant,
|
|
168
|
+
size: e.size,
|
|
169
|
+
rounded: e.rounded,
|
|
170
|
+
isUpdate: e.isUpdate
|
|
171
|
+
} : g(t) ? {
|
|
172
|
+
...l,
|
|
173
|
+
value: e.value,
|
|
174
|
+
values: e.values
|
|
175
|
+
} : l;
|
|
176
|
+
}), b = n(() => {
|
|
177
|
+
const t = e.field.type;
|
|
178
|
+
return t === "text" || t === "email" || t === "password" || t === "tel" || t === "url" || t === "search" || t === "textarea" || t === "switch" || t === "check" || t === "number" || !t ? {
|
|
179
|
+
"update:modelValue": N
|
|
180
|
+
} : t === "select" ? {
|
|
181
|
+
onSelect: (l) => {
|
|
182
|
+
d(l.value, l.data);
|
|
166
183
|
}
|
|
167
|
-
} :
|
|
168
|
-
change: (
|
|
169
|
-
} :
|
|
170
|
-
change: (
|
|
171
|
-
} :
|
|
172
|
-
change: (
|
|
173
|
-
l
|
|
184
|
+
} : t === "multiSelect" ? {
|
|
185
|
+
change: (l) => d(l)
|
|
186
|
+
} : t === "date" || t === "time" ? {
|
|
187
|
+
change: (l) => d(l)
|
|
188
|
+
} : t === "fileUploader" || t === "file" ? {
|
|
189
|
+
change: (l) => {
|
|
190
|
+
d(l);
|
|
191
|
+
},
|
|
192
|
+
"update:modelValue": (l) => {
|
|
193
|
+
d(l);
|
|
174
194
|
}
|
|
175
|
-
} :
|
|
176
|
-
change: (
|
|
177
|
-
l
|
|
195
|
+
} : t === "avatarUpload" ? {
|
|
196
|
+
change: (l) => {
|
|
197
|
+
d(l);
|
|
198
|
+
},
|
|
199
|
+
"update:modelValue": (l) => {
|
|
200
|
+
d(l);
|
|
178
201
|
}
|
|
179
|
-
} :
|
|
180
|
-
change: (
|
|
181
|
-
} :
|
|
182
|
-
onSelect: (
|
|
183
|
-
} :
|
|
184
|
-
change: (
|
|
185
|
-
} :
|
|
186
|
-
onChange: (
|
|
187
|
-
l
|
|
202
|
+
} : t === "color" ? {
|
|
203
|
+
change: (l) => d(l)
|
|
204
|
+
} : t === "iconPicker" ? {
|
|
205
|
+
onSelect: (l) => d(l)
|
|
206
|
+
} : t === "customFields" ? {
|
|
207
|
+
change: (l) => d(l)
|
|
208
|
+
} : g(t) ? {
|
|
209
|
+
onChange: (l) => {
|
|
210
|
+
d(l.value, l.data);
|
|
188
211
|
}
|
|
189
212
|
} : {};
|
|
190
|
-
})
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
213
|
+
}), O = n(() => v(e.field.addonLeft) || v(e.field.addonRight)), I = n(() => {
|
|
214
|
+
const t = e.field.type;
|
|
215
|
+
return t === "text" || t === "email" || t === "password" || t === "tel" || t === "url" || t === "search" || !t;
|
|
216
|
+
}), D = n(() => O.value && I.value), x = (t, l) => {
|
|
217
|
+
c("addonChange", t.name, { value: l.value });
|
|
218
|
+
}, R = (t) => {
|
|
219
|
+
t.action && c("addonAction", t.action);
|
|
220
|
+
};
|
|
221
|
+
return (t, l) => D.value ? (r(), u(y, s({ key: 0 }, {
|
|
222
|
+
...V.value,
|
|
223
|
+
...a.field?.props || {}
|
|
224
|
+
}, C(b.value)), E({ _: 2 }, [
|
|
225
|
+
L(v)(a.field.addonLeft) ? {
|
|
226
|
+
name: "addon-left",
|
|
227
|
+
fn: o(() => [
|
|
228
|
+
a.field.addonLeft.type === "select" ? (r(), u(k, s({
|
|
229
|
+
key: 0,
|
|
230
|
+
modelValue: a.values[a.field.addonLeft.name],
|
|
231
|
+
options: a.field.addonLeft.options || []
|
|
232
|
+
}, a.field.addonLeft.props || {}, {
|
|
233
|
+
onOnSelect: l[0] || (l[0] = (i) => x(a.field.addonLeft, i))
|
|
234
|
+
}), {
|
|
235
|
+
trigger: o(({ selectedLabel: i }) => [
|
|
236
|
+
S(h, { variant: "outline" }, {
|
|
237
|
+
default: o(() => [
|
|
238
|
+
m(p(i), 1)
|
|
239
|
+
]),
|
|
240
|
+
_: 2
|
|
241
|
+
}, 1024)
|
|
242
|
+
]),
|
|
243
|
+
_: 1
|
|
244
|
+
}, 16, ["modelValue", "options"])) : a.field.addonLeft.type === "button" ? (r(), u(h, s({
|
|
245
|
+
key: 1,
|
|
246
|
+
variant: "outline"
|
|
247
|
+
}, a.field.addonLeft.props || {}, {
|
|
248
|
+
onClick: l[1] || (l[1] = (i) => R(a.field.addonLeft))
|
|
249
|
+
}), {
|
|
250
|
+
default: o(() => [
|
|
251
|
+
m(p(a.field.addonLeft.text), 1)
|
|
252
|
+
]),
|
|
253
|
+
_: 1
|
|
254
|
+
}, 16)) : A("", !0)
|
|
255
|
+
]),
|
|
256
|
+
key: "0"
|
|
257
|
+
} : void 0,
|
|
258
|
+
L(v)(a.field.addonRight) ? {
|
|
259
|
+
name: "addon-right",
|
|
260
|
+
fn: o(() => [
|
|
261
|
+
a.field.addonRight.type === "select" ? (r(), u(k, s({
|
|
262
|
+
key: 0,
|
|
263
|
+
modelValue: a.values[a.field.addonRight.name],
|
|
264
|
+
options: a.field.addonRight.options || []
|
|
265
|
+
}, a.field.addonRight.props || {}, {
|
|
266
|
+
onOnSelect: l[2] || (l[2] = (i) => x(a.field.addonRight, i))
|
|
267
|
+
}), {
|
|
268
|
+
trigger: o(({ selectedLabel: i }) => [
|
|
269
|
+
S(h, { variant: "outline" }, {
|
|
270
|
+
default: o(() => [
|
|
271
|
+
m(p(i), 1)
|
|
272
|
+
]),
|
|
273
|
+
_: 2
|
|
274
|
+
}, 1024)
|
|
275
|
+
]),
|
|
276
|
+
_: 1
|
|
277
|
+
}, 16, ["modelValue", "options"])) : a.field.addonRight.type === "button" ? (r(), u(h, s({
|
|
278
|
+
key: 1,
|
|
279
|
+
variant: "outline"
|
|
280
|
+
}, a.field.addonRight.props || {}, {
|
|
281
|
+
onClick: l[3] || (l[3] = (i) => R(a.field.addonRight))
|
|
282
|
+
}), {
|
|
283
|
+
default: o(() => [
|
|
284
|
+
m(p(a.field.addonRight.text), 1)
|
|
285
|
+
]),
|
|
286
|
+
_: 1
|
|
287
|
+
}, 16)) : A("", !0)
|
|
288
|
+
]),
|
|
289
|
+
key: "1"
|
|
290
|
+
} : void 0
|
|
291
|
+
]), 1040)) : (r(), u(H(B.value), s({ key: 1 }, {
|
|
292
|
+
...V.value,
|
|
293
|
+
...a.field?.props || {}
|
|
294
|
+
}, C(b.value)), null, 16));
|
|
195
295
|
}
|
|
196
296
|
});
|
|
197
297
|
export {
|
|
198
|
-
|
|
298
|
+
oe as default
|
|
199
299
|
};
|
|
@@ -18,8 +18,10 @@ interface Props {
|
|
|
18
18
|
}
|
|
19
19
|
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
20
20
|
change: (name: string, payload: IFormFieldChangePayload) => any;
|
|
21
|
+
addonAction: (action: string) => any;
|
|
21
22
|
}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
|
|
22
23
|
onChange?: (name: string, payload: IFormFieldChangePayload) => any;
|
|
24
|
+
onAddonAction?: (action: string) => any;
|
|
23
25
|
}>, {
|
|
24
26
|
size: InputSize;
|
|
25
27
|
variant: InputVariant;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./FormFields.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import r from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const f = /* @__PURE__ */ r(o, [["__scopeId", "data-v-47af145c"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
f as default
|
|
7
7
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { isComponent as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent as R, computed as U, openBlock as a, createElementBlock as s, normalizeClass as h, Fragment as d, renderList as f, createBlock as u, withCtx as y, unref as w, resolveDynamicComponent as q, createTextVNode as b, toDisplayString as m, createCommentVNode as o, createVNode as E } from "vue";
|
|
2
|
+
import { isComponent as p, getNestedValue as L } from "./utils/form.utils.js";
|
|
3
|
+
import v from "../Label.vue.js";
|
|
4
|
+
import $ from "./FormField.vue.js";
|
|
5
|
+
const I = {
|
|
6
6
|
key: 0,
|
|
7
7
|
class: "text-destructive ml-0.5"
|
|
8
|
-
},
|
|
8
|
+
}, S = {
|
|
9
9
|
key: 0,
|
|
10
10
|
class: "text-destructive ml-0.5"
|
|
11
|
-
},
|
|
11
|
+
}, T = {
|
|
12
12
|
key: 2,
|
|
13
13
|
class: "mt-1 text-sm text-destructive"
|
|
14
|
-
},
|
|
14
|
+
}, K = /* @__PURE__ */ R({
|
|
15
15
|
__name: "FormFields",
|
|
16
16
|
props: {
|
|
17
17
|
schema: {},
|
|
@@ -26,70 +26,76 @@ const $ = {
|
|
|
26
26
|
isFieldDisabled: {},
|
|
27
27
|
isFieldReadonly: {}
|
|
28
28
|
},
|
|
29
|
-
emits: ["change"],
|
|
30
|
-
setup(
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
33
|
-
}), g = (t) =>
|
|
29
|
+
emits: ["change", "addonAction"],
|
|
30
|
+
setup(r, { emit: F }) {
|
|
31
|
+
const n = r, l = F, k = U(() => {
|
|
32
|
+
if (n.className) return n.className;
|
|
33
|
+
}), g = (t) => L(n.values, t.name), c = (t) => n.errors[t.name] || "", C = (t) => n.isFieldVisible ? n.isFieldVisible(t) : !0, x = (t) => n.isFieldDisabled ? n.isFieldDisabled(t) : t.disabled === !0, V = (t) => n.isFieldReadonly ? n.isFieldReadonly(t) : t.readonly === !0, A = (t) => {
|
|
34
34
|
if (t)
|
|
35
|
-
return
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
return p(t), t;
|
|
36
|
+
}, N = (t, i) => {
|
|
37
|
+
l("change", t.name, i);
|
|
38
|
+
}, D = (t) => t.itemClass || "", _ = (t, i) => {
|
|
39
|
+
l("change", t, i);
|
|
40
|
+
}, z = (t) => {
|
|
41
|
+
l("addonAction", t);
|
|
42
|
+
};
|
|
43
|
+
return (t, i) => (a(), s("div", {
|
|
44
|
+
class: h(["grid gap-4", k.value])
|
|
41
45
|
}, [
|
|
42
|
-
(
|
|
46
|
+
(a(!0), s(d, null, f(r.schema, (e) => (a(), s(d, {
|
|
43
47
|
key: e.name
|
|
44
48
|
}, [
|
|
45
|
-
C(e) ? (
|
|
49
|
+
C(e) ? (a(), s("div", {
|
|
46
50
|
key: 0,
|
|
47
|
-
class:
|
|
51
|
+
class: h(["form-field-item", D(e)])
|
|
48
52
|
}, [
|
|
49
|
-
e.label && e.type !== "switch" && e.type !== "check" && e.type !== "customFields" ? (
|
|
53
|
+
e.label && e.type !== "switch" && e.type !== "check" && e.type !== "customFields" ? (a(), u(v, {
|
|
50
54
|
key: 0,
|
|
51
55
|
for: e.name,
|
|
52
56
|
class: "mb-2 block text-sm font-medium"
|
|
53
57
|
}, {
|
|
54
58
|
default: y(() => [
|
|
55
|
-
|
|
56
|
-
b(
|
|
57
|
-
e.required ? (
|
|
59
|
+
w(p)(e.label) ? (a(), u(q(A(e.label)), { key: 0 })) : (a(), s(d, { key: 1 }, [
|
|
60
|
+
b(m(e.label) + " ", 1),
|
|
61
|
+
e.required ? (a(), s("span", I, "*")) : o("", !0)
|
|
58
62
|
], 64))
|
|
59
63
|
]),
|
|
60
64
|
_: 2
|
|
61
65
|
}, 1032, ["for"])) : o("", !0),
|
|
62
|
-
|
|
66
|
+
E($, {
|
|
63
67
|
field: e,
|
|
64
68
|
value: g(e),
|
|
65
69
|
label: e.type === "customFields" ? e.label : void 0,
|
|
66
|
-
values:
|
|
67
|
-
variant:
|
|
68
|
-
size:
|
|
69
|
-
rounded:
|
|
70
|
+
values: r.values,
|
|
71
|
+
variant: r.variant,
|
|
72
|
+
size: r.size,
|
|
73
|
+
rounded: r.rounded,
|
|
70
74
|
disabled: x(e),
|
|
71
75
|
readonly: V(e),
|
|
72
|
-
error:
|
|
73
|
-
isUpdate:
|
|
74
|
-
onChange: (
|
|
76
|
+
error: c(e),
|
|
77
|
+
isUpdate: r.isUpdate,
|
|
78
|
+
onChange: (B) => N(e, B),
|
|
79
|
+
onAddonChange: _,
|
|
80
|
+
onAddonAction: z
|
|
75
81
|
}, null, 8, ["field", "value", "label", "values", "variant", "size", "rounded", "disabled", "readonly", "error", "isUpdate", "onChange"]),
|
|
76
|
-
e.label && (e.type === "switch" || e.type === "check") ? (
|
|
82
|
+
e.label && (e.type === "switch" || e.type === "check") ? (a(), u(v, {
|
|
77
83
|
key: 1,
|
|
78
84
|
for: e.name,
|
|
79
85
|
class: "ml-2 text-sm font-medium cursor-pointer"
|
|
80
86
|
}, {
|
|
81
87
|
default: y(() => [
|
|
82
|
-
b(
|
|
83
|
-
e.required ? (
|
|
88
|
+
b(m(e.label) + " ", 1),
|
|
89
|
+
e.required ? (a(), s("span", S, "*")) : o("", !0)
|
|
84
90
|
]),
|
|
85
91
|
_: 2
|
|
86
92
|
}, 1032, ["for"])) : o("", !0),
|
|
87
|
-
|
|
93
|
+
c(e) ? (a(), s("p", T, m(c(e)), 1)) : o("", !0)
|
|
88
94
|
], 2)) : o("", !0)
|
|
89
95
|
], 64))), 128))
|
|
90
96
|
], 2));
|
|
91
97
|
}
|
|
92
98
|
});
|
|
93
99
|
export {
|
|
94
|
-
|
|
100
|
+
K as default
|
|
95
101
|
};
|
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
import { Component } from 'vue';
|
|
2
2
|
import { IDropdownOptions, InputVariant, InputSize, InputRounded } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Addon configuration for input field addons (left/right)
|
|
5
|
+
* Allows rendering dropdowns or buttons inside input addons from schema
|
|
6
|
+
*/
|
|
7
|
+
export interface IFormAddon {
|
|
8
|
+
/** Key in form values this addon writes to (required for select, optional for button) */
|
|
9
|
+
name?: string;
|
|
10
|
+
/** 'select' renders a Dropdown; 'button' renders a Button */
|
|
11
|
+
type: 'select' | 'button';
|
|
12
|
+
/** Default value (for select addons) */
|
|
13
|
+
value?: any;
|
|
14
|
+
/** Dropdown options (required when type='select') */
|
|
15
|
+
options?: IDropdownOptions;
|
|
16
|
+
/** Button label (required when type='button') */
|
|
17
|
+
text?: string;
|
|
18
|
+
/** Emitted action name on button click */
|
|
19
|
+
action?: string;
|
|
20
|
+
/** Extra props forwarded to the rendered component */
|
|
21
|
+
props?: Record<string, any>;
|
|
22
|
+
}
|
|
3
23
|
/**
|
|
4
24
|
* Form field types - maps to corresponding UI components
|
|
5
25
|
*/
|
|
@@ -75,10 +95,10 @@ export interface IForm {
|
|
|
75
95
|
disabled?: IFormDisabled;
|
|
76
96
|
/** Readonly state - boolean or conditional function */
|
|
77
97
|
readonly?: IFormDisabled;
|
|
78
|
-
/** Left addon text */
|
|
79
|
-
addonLeft?: string;
|
|
80
|
-
/** Right addon text */
|
|
81
|
-
addonRight?: string;
|
|
98
|
+
/** Left addon — plain text or an addon config object (select/button) */
|
|
99
|
+
addonLeft?: string | IFormAddon;
|
|
100
|
+
/** Right addon — plain text or an addon config object (select/button) */
|
|
101
|
+
addonRight?: string | IFormAddon;
|
|
82
102
|
/** Options for select/multiSelect/dropdown fields */
|
|
83
103
|
options?: IDropdownOptions;
|
|
84
104
|
/** Validation function - returns error message or empty string */
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import { IForm, IFormContext, IFormDisabled, IFormWhen } from '../types';
|
|
1
|
+
import { IForm, IFormAddon, IFormContext, IFormDisabled, IFormWhen } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Helper: check if an addon definition is an object config (not a plain string)
|
|
4
|
+
*/
|
|
5
|
+
export declare function isAddonObject(addon: string | IFormAddon | undefined): addon is IFormAddon;
|
|
2
6
|
/**
|
|
3
7
|
* Get a nested value from an object using dot notation path
|
|
4
8
|
* @example getNestedValue({ pricing: { amount: 100 } }, 'pricing.amount') => 100
|