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.
Files changed (55) hide show
  1. package/README.md +226 -150
  2. package/components/Button.vue.js +1 -1
  3. package/components/Chip/Chip.vue.js +15 -15
  4. package/components/DataTable/DataTable.vue.js +2 -2
  5. package/components/DataTable/DataTable.vue2.js +41 -39
  6. package/components/DataTable/types.d.ts +1 -0
  7. package/components/DatePicker.vue.d.ts +12 -3
  8. package/components/DatePicker.vue.js +80 -39
  9. package/components/Dropdown/DropdownMenu.vue.js +48 -47
  10. package/components/Form/Form.vue.d.ts +2 -0
  11. package/components/Form/Form.vue.js +2 -2
  12. package/components/Form/Form.vue2.js +104 -101
  13. package/components/Form/FormField.vue.d.ts +4 -0
  14. package/components/Form/FormField.vue.js +248 -148
  15. package/components/Form/FormFields.vue.d.ts +2 -0
  16. package/components/Form/FormFields.vue.js +2 -2
  17. package/components/Form/FormFields.vue2.js +45 -39
  18. package/components/Form/types.d.ts +24 -4
  19. package/components/Form/utils/form.utils.d.ts +5 -1
  20. package/components/Form/utils/form.utils.js +69 -60
  21. package/components/GoogleLogin.vue.d.ts +41 -0
  22. package/components/GoogleLogin.vue.js +60 -0
  23. package/components/GoogleLogin.vue2.js +4 -0
  24. package/components/Input.vue.js +120 -111
  25. package/components/NumberInput.vue.d.ts +38 -0
  26. package/components/NumberInput.vue.js +7 -0
  27. package/components/NumberInput.vue2.js +191 -0
  28. package/components/Pagination/Pagination.vue.d.ts +1 -0
  29. package/components/Pagination/Pagination.vue.js +60 -46
  30. package/components/ProgressBar/ProgressBar.vue.d.ts +12 -0
  31. package/components/ProgressBar/ProgressBar.vue.js +7 -0
  32. package/components/ProgressBar/ProgressBar.vue2.js +158 -0
  33. package/components/ProgressBar/index.d.ts +3 -0
  34. package/components/Spinner/Spinner.vue.d.ts +8 -0
  35. package/components/Spinner/Spinner.vue.js +89 -0
  36. package/components/Spinner/Spinner.vue2.js +4 -0
  37. package/components/Spinner/index.d.ts +2 -0
  38. package/components/Spinner/types.d.ts +9 -0
  39. package/components/Tabes/Tabes.vue.d.ts +3 -1
  40. package/components/Tabes/Tabes.vue.js +103 -44
  41. package/directives/vScrollReveal.d.ts +2 -0
  42. package/directives/vScrollReveal.js +48 -0
  43. package/index.d.ts +8 -0
  44. package/index.js +180 -147
  45. package/package.json +6 -3
  46. package/style.css +56 -4
  47. package/types/form.type.d.ts +2 -2
  48. package/types/progressbar.d.ts +75 -0
  49. package/utils/env.d.ts +14 -0
  50. package/utils/env.js +4 -0
  51. package/utils/functions.d.ts +99 -0
  52. package/utils/functions.js +91 -7
  53. package/utils/index.d.ts +2 -0
  54. package/utils/search.util.d.ts +127 -0
  55. package/utils/search.util.js +363 -0
@@ -1,13 +1,15 @@
1
- import { defineComponent as b, defineAsyncComponent as t, computed as i, markRaw as k, openBlock as V, createBlock as x, resolveDynamicComponent as w, mergeProps as C, toHandlers as P } from "vue";
2
- import { isComponent as o } from "./utils/form.utils.js";
3
- import d from "../Input.vue.js";
4
- import U from "../Switch.vue.js";
5
- import z from "../CheckBox.vue.js";
6
- import S from "../Textarea.vue.js";
7
- import F from "../FilePicker/FilePicker.vue.js";
8
- import $ from "../AvatarUploader/AvatarUploader.vue.js";
9
- import A from "../Dropdown/Dropdown.vue.js";
10
- const O = /* @__PURE__ */ b({
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(n, { emit: c }) {
26
- const u = t(() => import("../MultiSelect/MultiSelect.vue2.js")), f = t(() => import("../DatePicker.vue2.js")), m = t(() => import("../ColorPicker/ColorPicker.vue2.js")), p = t(() => import("../IconPicker.vue2.js")), h = t(() => import("./CustomFields.vue.js")), r = n, s = c, l = (e, a) => {
27
- s("change", { value: e, data: a });
28
- }, v = (e) => {
29
- s("change", { value: e });
30
- }, _ = i(() => {
31
- const e = r.field.type;
32
- if (o(e))
33
- return k(e);
34
- switch (e) {
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 d;
43
+ return y;
44
+ case "number":
45
+ return M;
43
46
  case "textarea":
44
- return S;
47
+ return J;
45
48
  case "switch":
46
- return U;
49
+ return q;
47
50
  case "check":
48
- return z;
51
+ return G;
49
52
  case "select":
50
- return A;
53
+ return k;
51
54
  case "multiSelect":
52
- return u;
55
+ return z;
53
56
  case "date":
54
57
  case "time":
55
- return f;
58
+ return $;
56
59
  case "file":
57
60
  case "fileUploader":
58
- return F;
61
+ return K;
59
62
  case "avatarUpload":
60
- return $;
63
+ return Q;
61
64
  case "color":
62
- return m;
65
+ return P;
63
66
  case "iconPicker":
64
- return p;
67
+ return U;
65
68
  case "customFields":
66
- return h;
69
+ return F;
67
70
  default:
68
- return d;
71
+ return y;
69
72
  }
70
- }), y = i(() => {
71
- const e = r.field.type, a = {
72
- disabled: r.disabled || r.field.disabled === !0,
73
- ...r.field.props || {}
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 e === "text" || e === "email" || e === "password" || e === "number" || e === "tel" || e === "url" || e === "search" || !e ? {
76
- ...a,
77
- modelValue: r.value ?? "",
78
- type: e || "text",
79
- placeholder: r.field.placeholder,
80
- icon: r.field.icon,
81
- iconRight: r.field.iconRight,
82
- addonLeft: r.field.addonLeft,
83
- addonRight: r.field.addonRight,
84
- variant: r.variant,
85
- size: r.size,
86
- rounded: r.rounded,
87
- error: r.error,
88
- min: r.field.min,
89
- max: r.field.max,
90
- class: r.field.className
91
- } : e === "textarea" ? {
92
- ...a,
93
- modelValue: r.value ?? "",
94
- placeholder: r.field.placeholder,
95
- rows: r.field.props?.rows || 3,
96
- class: r.field.className
97
- } : e === "switch" ? {
98
- ...a,
99
- modelValue: !!r.value,
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
- } : e === "check" ? {
103
- ...a,
104
- modelValue: !!r.value,
119
+ } : t === "check" ? {
120
+ ...l,
121
+ modelValue: !!e.value,
105
122
  label: ""
106
123
  // Label handled externally
107
- } : e === "select" ? {
108
- ...a,
109
- modelValue: r.value,
110
- options: r.field.options || [],
111
- placeholder: r.field.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
- } : e === "multiSelect" ? {
115
- ...a,
116
- modelValue: Array.isArray(r.value) ? r.value : [],
117
- options: r.field.options || [],
118
- placeholder: r.field.placeholder
119
- } : e === "date" || e === "time" ? {
120
- ...a,
121
- modelValue: r.value,
122
- mode: e === "time" ? "time" : "date",
123
- placeholder: r.field.placeholder
124
- } : e === "fileUploader" || e === "file" ? {
125
- ...a,
126
- modelValue: r.value,
127
- multiSelect: r.field.props?.multiple || !1,
128
- fileTypes: r.field.props?.accept ? r.field.props.accept.split(",") : [],
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: e === "file" ? "input" : "dropzone",
131
- placeholder: r.field.placeholder,
132
- size: r.size,
133
- rounded: r.rounded
134
- } : e === "avatarUpload" ? {
135
- ...a,
136
- modelValue: r.value,
137
- editable: !r.readonly
138
- } : e === "color" ? {
139
- ...a,
140
- modelValue: r.value || "#000000"
141
- } : e === "iconPicker" ? {
142
- ...a,
143
- value: r.value || "lucide:smile"
144
- } : e === "customFields" ? {
145
- ...a,
146
- modelValue: Array.isArray(r.value) ? r.value : [],
147
- schema: r.field.props?.schema || [],
148
- headers: r.field.props?.headers || [],
149
- values: r.values,
150
- variant: r.variant,
151
- size: r.size,
152
- rounded: r.rounded,
153
- isUpdate: r.isUpdate
154
- } : o(e) ? {
155
- ...a,
156
- value: r.value,
157
- values: r.values
158
- } : a;
159
- }), g = i(() => {
160
- const e = r.field.type;
161
- return e === "text" || e === "email" || e === "password" || e === "number" || e === "tel" || e === "url" || e === "search" || e === "textarea" || e === "switch" || e === "check" || !e ? {
162
- "update:modelValue": v
163
- } : e === "select" ? {
164
- onSelect: (a) => {
165
- l(a.value, a.data);
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
- } : e === "multiSelect" ? {
168
- change: (a) => l(a)
169
- } : e === "date" || e === "time" ? {
170
- change: (a) => l(a)
171
- } : e === "fileUploader" || e === "file" ? {
172
- change: (a) => {
173
- l(a);
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
- } : e === "avatarUpload" ? {
176
- change: (a) => {
177
- l(a);
195
+ } : t === "avatarUpload" ? {
196
+ change: (l) => {
197
+ d(l);
198
+ },
199
+ "update:modelValue": (l) => {
200
+ d(l);
178
201
  }
179
- } : e === "color" ? {
180
- change: (a) => l(a)
181
- } : e === "iconPicker" ? {
182
- onSelect: (a) => l(a)
183
- } : e === "customFields" ? {
184
- change: (a) => l(a)
185
- } : o(e) ? {
186
- onChange: (a) => {
187
- l(a.value, a.data);
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
- return (e, a) => (V(), x(w(_.value), C({
192
- ...y.value,
193
- ...n.field?.props || {}
194
- }, P(g.value)), null, 16));
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
- O as default
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 e = /* @__PURE__ */ r(o, [["__scopeId", "data-v-5c98aa0e"]]);
4
+ const f = /* @__PURE__ */ r(o, [["__scopeId", "data-v-47af145c"]]);
5
5
  export {
6
- e as default
6
+ f as default
7
7
  };
@@ -1,17 +1,17 @@
1
- import { defineComponent as B, computed as R, openBlock as s, createElementBlock as a, normalizeClass as d, Fragment as l, renderList as U, createBlock as c, withCtx as y, unref as f, resolveDynamicComponent as w, createTextVNode as b, toDisplayString as u, createCommentVNode as o, createVNode as q } from "vue";
2
- import { isComponent as h, getNestedValue as E } from "./utils/form.utils.js";
3
- import p from "../Label.vue.js";
4
- import L from "./FormField.vue.js";
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
- }, I = {
8
+ }, S = {
9
9
  key: 0,
10
10
  class: "text-destructive ml-0.5"
11
- }, S = {
11
+ }, T = {
12
12
  key: 2,
13
13
  class: "mt-1 text-sm text-destructive"
14
- }, H = /* @__PURE__ */ B({
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(n, { emit: v }) {
31
- const r = n, F = v, k = R(() => {
32
- if (r.className) return r.className;
33
- }), g = (t) => E(r.values, t.name), i = (t) => r.errors[t.name] || "", C = (t) => r.isFieldVisible ? r.isFieldVisible(t) : !0, x = (t) => r.isFieldDisabled ? r.isFieldDisabled(t) : t.disabled === !0, V = (t) => r.isFieldReadonly ? r.isFieldReadonly(t) : t.readonly === !0, N = (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 h(t), t;
36
- }, D = (t, m) => {
37
- F("change", t.name, m);
38
- }, _ = (t) => t.itemClass || "";
39
- return (t, m) => (s(), a("div", {
40
- class: d(["grid gap-4", k.value])
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
- (s(!0), a(l, null, U(n.schema, (e) => (s(), a(l, {
46
+ (a(!0), s(d, null, f(r.schema, (e) => (a(), s(d, {
43
47
  key: e.name
44
48
  }, [
45
- C(e) ? (s(), a("div", {
49
+ C(e) ? (a(), s("div", {
46
50
  key: 0,
47
- class: d(["form-field-item", _(e)])
51
+ class: h(["form-field-item", D(e)])
48
52
  }, [
49
- e.label && e.type !== "switch" && e.type !== "check" && e.type !== "customFields" ? (s(), c(p, {
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
- f(h)(e.label) ? (s(), c(w(N(e.label)), { key: 0 })) : (s(), a(l, { key: 1 }, [
56
- b(u(e.label) + " ", 1),
57
- e.required ? (s(), a("span", $, "*")) : o("", !0)
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
- q(L, {
66
+ E($, {
63
67
  field: e,
64
68
  value: g(e),
65
69
  label: e.type === "customFields" ? e.label : void 0,
66
- values: n.values,
67
- variant: n.variant,
68
- size: n.size,
69
- rounded: n.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: i(e),
73
- isUpdate: n.isUpdate,
74
- onChange: (z) => D(e, z)
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") ? (s(), c(p, {
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(u(e.label) + " ", 1),
83
- e.required ? (s(), a("span", I, "*")) : o("", !0)
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
- i(e) ? (s(), a("p", S, u(i(e)), 1)) : o("", !0)
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
- H as default
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