vlite3 1.4.4 → 1.4.6

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 (102) hide show
  1. package/components/AppShell/AppShellLayoutStorefront.vue.d.ts +4 -17
  2. package/components/AppShell/AppShellLayoutStorefront.vue.js +116 -152
  3. package/components/AvatarUploader/AvatarUploader.vue.d.ts +1 -1
  4. package/components/AvatarUploader/AvatarUploader.vue.js +1 -1
  5. package/components/Cart/Cart.vue.js +242 -0
  6. package/components/Cart/Cart.vue2.js +4 -0
  7. package/components/Cart/CartCouponInput.vue.js +176 -0
  8. package/components/Cart/CartCouponInput.vue2.js +4 -0
  9. package/components/Cart/CartEmptyState.vue.js +48 -0
  10. package/components/Cart/CartEmptyState.vue2.js +4 -0
  11. package/components/Cart/CartLineItem.vue.js +341 -0
  12. package/components/Cart/CartLineItem.vue2.js +4 -0
  13. package/components/Cart/CartSummary.vue.js +157 -0
  14. package/components/Cart/CartSummary.vue2.js +4 -0
  15. package/components/Cart/CartVariant1.vue.js +156 -0
  16. package/components/Cart/CartVariant1.vue2.js +4 -0
  17. package/components/Cart/CartVariant2.vue.js +154 -0
  18. package/components/Cart/CartVariant2.vue2.js +4 -0
  19. package/components/Cart/CartVariant3.vue.js +192 -0
  20. package/components/Cart/CartVariant3.vue2.js +4 -0
  21. package/components/Cart/CartVariant4.vue.js +145 -0
  22. package/components/Cart/CartVariant4.vue2.js +4 -0
  23. package/components/Cart/composables/useCart.d.ts +46 -0
  24. package/components/Cart/composables/useCart.js +110 -0
  25. package/components/Cart/composables/useCartCalculation.js +145 -0
  26. package/components/Cart/index.d.ts +2 -0
  27. package/components/CategoryManager/CategoryManager.vue.js +3 -3
  28. package/components/CategoryManager/CategoryManager.vue2.js +225 -249
  29. package/components/CategoryManager/utils.d.ts +3 -0
  30. package/components/CategoryManager/utils.js +31 -0
  31. package/components/CategoryMenu/CategoryMenu.vue.d.ts +2 -0
  32. package/components/CategoryMenu/CategoryMenu.vue.js +46 -40
  33. package/components/CategoryMenu/CategoryMenuVariant1.vue.d.ts +5 -1
  34. package/components/CategoryMenu/CategoryMenuVariant1.vue.js +5 -144
  35. package/components/CategoryMenu/CategoryMenuVariant1.vue2.js +220 -2
  36. package/components/CategoryMenu/CategoryMenuVariant2.vue.d.ts +5 -1
  37. package/components/CategoryMenu/CategoryMenuVariant2.vue.js +5 -160
  38. package/components/CategoryMenu/CategoryMenuVariant2.vue2.js +235 -2
  39. package/components/CategoryMenu/types.d.ts +5 -2
  40. package/components/Chat/ChatInterface.vue.js +1 -1
  41. package/components/Comment/CommentEditor.vue.js +1 -1
  42. package/components/Dropdown/Dropdown.vue.d.ts +1 -0
  43. package/components/Dropdown/Dropdown.vue.js +31 -29
  44. package/components/FilePicker/FilePickerDropzone.vue.d.ts +27 -0
  45. package/components/FilePicker/FilePickerDropzone.vue.js +117 -0
  46. package/components/FilePicker/FilePickerDropzone.vue2.js +4 -0
  47. package/components/FilePicker/FilePickerInput.vue.d.ts +22 -0
  48. package/components/FilePicker/FilePickerInput.vue.js +147 -0
  49. package/components/FilePicker/FilePickerInput.vue2.js +4 -0
  50. package/components/FilePicker/FilePreview.vue.d.ts +21 -0
  51. package/components/FilePicker/FilePreview.vue.js +95 -0
  52. package/components/FilePicker/FilePreview.vue2.js +4 -0
  53. package/components/FilePicker/composables/useFileProcessing.d.ts +65 -0
  54. package/components/FilePicker/composables/useFileProcessing.js +141 -0
  55. package/components/FilePicker/index.d.ts +2 -2
  56. package/components/FilePicker/{FilePicker.vue.d.ts → index.vue.d.ts} +11 -18
  57. package/components/FilePicker/index.vue.js +131 -0
  58. package/components/FilePicker/index.vue2.js +4 -0
  59. package/components/FilePicker/types.d.ts +17 -0
  60. package/components/FilePicker/utils.d.ts +23 -0
  61. package/components/FilePicker/utils.js +37 -0
  62. package/components/Form/AccordionView.vue.d.ts +26 -0
  63. package/components/Form/AccordionView.vue.js +219 -0
  64. package/components/Form/AccordionView.vue2.js +4 -0
  65. package/components/Form/FormField.vue.js +3 -3
  66. package/components/Form/FormFields.vue.js +2 -2
  67. package/components/Form/TableRow.vue.d.ts +18 -0
  68. package/components/Form/TableRow.vue.js +88 -0
  69. package/components/Form/TableRow.vue2.js +4 -0
  70. package/components/Form/TableView.vue.d.ts +23 -0
  71. package/components/Form/TableView.vue.js +88 -0
  72. package/components/Form/TableView.vue2.js +4 -0
  73. package/components/Form/composables/useCustomFieldRows.d.ts +52 -0
  74. package/components/Form/composables/useCustomFieldRows.js +77 -0
  75. package/components/Form/index.d.ts +1 -1
  76. package/components/Form/{CustomFields.vue.d.ts → index.vue.d.ts} +8 -5
  77. package/components/Form/index.vue.js +7 -0
  78. package/components/Form/index.vue2.js +141 -0
  79. package/components/Form/rowHelpers.d.ts +45 -0
  80. package/components/Form/rowHelpers.js +40 -0
  81. package/components/Form/types.d.ts +3 -0
  82. package/components/IconPicker.vue.d.ts +2 -2
  83. package/components/Modal.vue.d.ts +2 -0
  84. package/components/Modal.vue.js +1 -1
  85. package/components/Modal.vue2.js +30 -28
  86. package/components/Screen/ScreenFilter.vue.js +4 -3
  87. package/components/SidePanel.vue.d.ts +2 -0
  88. package/components/SidePanel.vue.js +1 -1
  89. package/components/SidePanel.vue2.js +25 -23
  90. package/components/SidebarMenu/SidebarMenu.vue.js +145 -128
  91. package/components/ThumbnailSelector/ThumbnailSelector.vue.js +1 -1
  92. package/components/ThumbnailSelector/ThumbnailSelector.vue2.js +1 -1
  93. package/components/index.d.ts +2 -1
  94. package/core/config.d.ts +6 -6
  95. package/index.d.ts +1 -0
  96. package/index.js +328 -307
  97. package/package.json +1 -1
  98. package/style.css +1 -1
  99. package/components/FilePicker/FilePicker.vue.js +0 -361
  100. package/components/FilePicker/FilePicker.vue2.js +0 -4
  101. package/components/Form/CustomFields.vue.js +0 -7
  102. package/components/Form/CustomFields.vue2.js +0 -261
@@ -0,0 +1,88 @@
1
+ import { defineComponent as x, computed as s, withMemo as h, openBlock as o, createElementBlock as n, normalizeClass as u, createVNode as m, createCommentVNode as l, toDisplayString as y, Fragment as v, renderList as f, createBlock as R, unref as d } from "vue";
2
+ import I from "./FormField.vue.js";
3
+ import C from "../Icon.vue.js";
4
+ import F from "../Button.vue.js";
5
+ import { resolveFieldType as i } from "./utils/form.utils.js";
6
+ const k = {
7
+ key: 1,
8
+ class: "w-10 flex-none flex items-center justify-center text-xs text-muted-foreground border-r border-border bg-muted/20"
9
+ }, B = {
10
+ key: 2,
11
+ class: "w-10 flex-none flex items-center justify-center border-l border-border bg-muted/20"
12
+ }, z = /* @__PURE__ */ x({
13
+ __name: "TableRow",
14
+ props: {
15
+ row: {},
16
+ rowIndex: {},
17
+ fields: {},
18
+ draggable: { type: Boolean },
19
+ disabled: { type: Boolean },
20
+ readonly: { type: Boolean },
21
+ isUpdate: { type: Boolean },
22
+ showRowNumbers: { type: Boolean },
23
+ canRemoveRow: { type: Boolean },
24
+ helpers: {},
25
+ onFieldChange: { type: Function },
26
+ onRemoveRow: { type: Function }
27
+ },
28
+ setup(e) {
29
+ const t = e, c = s(() => t.draggable && !t.disabled && !t.readonly), w = s(() => t.helpers.getRowErrorsHash(t.rowIndex));
30
+ return (U, a) => h([e.row, e.disabled, e.readonly, e.isUpdate, e.showRowNumbers, e.canRemoveRow, e.draggable, e.rowIndex, w.value], () => (o(), n("div", { class: "flex group bg-white transition-colors min-w-0" }, [
31
+ c.value ? (o(), n("div", {
32
+ key: 0,
33
+ class: u([
34
+ "w-10 flex-none flex items-center justify-center border-r border-border bg-muted/5 drag-handle transition-colors",
35
+ e.disabled ? "cursor-not-allowed opacity-50" : "cursor-grab active:cursor-grabbing hover:bg-muted/10 text-muted-foreground hover:text-foreground"
36
+ ])
37
+ }, [
38
+ m(C, {
39
+ icon: "lucide:grip-vertical",
40
+ class: "w-4 h-4"
41
+ })
42
+ ], 2)) : l("", !0),
43
+ e.showRowNumbers ? (o(), n("div", k, y(e.rowIndex + 1), 1)) : l("", !0),
44
+ (o(!0), n(v, null, f(e.fields, (r, b) => (o(), n("div", {
45
+ key: r.name,
46
+ class: u(["flex-1 min-w-0 relative", { "border-l border-border": b > 0 }])
47
+ }, [
48
+ e.helpers.isFieldVisible(e.rowIndex, r) ? (o(), R(I, {
49
+ key: 0,
50
+ field: {
51
+ ...r,
52
+ props: {
53
+ ...d(i)(r, e.helpers.getRowContext(e.rowIndex)) === "multiSelect" ? { showControls: !1, wrap: !1 } : {},
54
+ ...r.props || {},
55
+ ...d(i)(r, e.helpers.getRowContext(e.rowIndex)) === "file" || d(i)(r, e.helpers.getRowContext(e.rowIndex)) === "fileUploader" ? { variant: "input" } : {}
56
+ },
57
+ label: void 0
58
+ },
59
+ value: e.helpers.getFieldValue(e.rowIndex, r.name),
60
+ values: e.row,
61
+ errors: e.helpers.errors,
62
+ error: e.helpers.getFieldError(e.rowIndex, r.name),
63
+ variant: "transparent",
64
+ size: "sm",
65
+ rounded: "none",
66
+ disabled: e.disabled || e.helpers.isFieldDisabled(e.rowIndex, r),
67
+ readonly: e.readonly || e.helpers.isFieldReadonly(e.rowIndex, r),
68
+ isUpdate: e.isUpdate,
69
+ class: "w-full h-full min-h-[40px]",
70
+ onChange: (g) => e.onFieldChange(e.rowIndex, r.name, g)
71
+ }, null, 8, ["field", "value", "values", "errors", "error", "disabled", "readonly", "isUpdate", "onChange"])) : l("", !0)
72
+ ], 2))), 128)),
73
+ e.canRemoveRow ? (o(), n("div", B, [
74
+ m(F, {
75
+ type: "button",
76
+ variant: "ghost",
77
+ size: "xs",
78
+ icon: "lucide:trash-2",
79
+ disabled: e.disabled || e.readonly,
80
+ onClick: a[0] || (a[0] = (r) => e.onRemoveRow(e.rowIndex))
81
+ }, null, 8, ["disabled"])
82
+ ])) : l("", !0)
83
+ ])), a, 1);
84
+ }
85
+ });
86
+ export {
87
+ z as default
88
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./TableRow.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,23 @@
1
+ import { IForm, IFormFieldChangePayload } from './types';
2
+ import { CustomFieldRow, RowHelpers } from './rowHelpers';
3
+ interface Props {
4
+ rows: CustomFieldRow[];
5
+ schema: IForm[];
6
+ columnHeaders: string[];
7
+ visibleSchemaFields: IForm[];
8
+ draggable: boolean;
9
+ disabled: boolean;
10
+ readonly: boolean;
11
+ isUpdate: boolean;
12
+ showRowNumbers: boolean;
13
+ canRemoveRow: boolean;
14
+ canAddRow: boolean;
15
+ helpers: RowHelpers;
16
+ emptyTitle: string;
17
+ emptyDescription: string;
18
+ onFieldChange: (rowIndex: number, fieldName: string, payload: IFormFieldChangePayload) => void;
19
+ onRemoveRow: (index: number) => void;
20
+ onDragUpdate: (rows: CustomFieldRow[]) => void;
21
+ }
22
+ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
23
+ export default _default;
@@ -0,0 +1,88 @@
1
+ import { defineComponent as c, openBlock as o, createElementBlock as t, createCommentVNode as d, Fragment as l, renderList as i, normalizeClass as m, toDisplayString as r, createVNode as u, unref as b, withCtx as w, createBlock as g, createElementVNode as s } from "vue";
2
+ import { VueDraggable as y } from "vue-draggable-plus";
3
+ import h from "./TableRow.vue.js";
4
+ const f = { class: "custom-fields-table border border-border rounded overflow-hidden bg-background min-w-0 max-w-full w-full" }, v = {
5
+ key: 0,
6
+ class: "flex border-b border-border bg-muted/50 text-gray-800 text-xs font-semibold uppercase tracking-wider min-w-0"
7
+ }, x = {
8
+ key: 0,
9
+ class: "w-10 flex-none p-3 border-r border-border"
10
+ }, R = {
11
+ key: 1,
12
+ class: "w-10 flex-none p-3 text-center border-r border-border"
13
+ }, k = {
14
+ key: 2,
15
+ class: "w-10 flex-none p-3"
16
+ }, B = {
17
+ key: 1,
18
+ class: "flex flex-col items-center justify-center py-6 text-center bg-muted/5"
19
+ }, F = { class: "text-sm font-medium text-foreground" }, V = { class: "text-xs text-muted-foreground mt-1" }, S = /* @__PURE__ */ c({
20
+ __name: "TableView",
21
+ props: {
22
+ rows: {},
23
+ schema: {},
24
+ columnHeaders: {},
25
+ visibleSchemaFields: {},
26
+ draggable: { type: Boolean },
27
+ disabled: { type: Boolean },
28
+ readonly: { type: Boolean },
29
+ isUpdate: { type: Boolean },
30
+ showRowNumbers: { type: Boolean },
31
+ canRemoveRow: { type: Boolean },
32
+ canAddRow: { type: Boolean },
33
+ helpers: {},
34
+ emptyTitle: {},
35
+ emptyDescription: {},
36
+ onFieldChange: { type: Function },
37
+ onRemoveRow: { type: Function },
38
+ onDragUpdate: { type: Function }
39
+ },
40
+ setup(e) {
41
+ return (C, D) => (o(), t("div", f, [
42
+ e.columnHeaders.length > 1 ? (o(), t("div", v, [
43
+ e.draggable && !e.disabled && !e.readonly ? (o(), t("div", x)) : d("", !0),
44
+ e.showRowNumbers ? (o(), t("div", R, " # ")) : d("", !0),
45
+ (o(!0), t(l, null, i(e.columnHeaders, (n, a) => (o(), t("div", {
46
+ key: a,
47
+ class: m(["flex-1 p-3 min-w-0 truncate", { "border-l border-border": a > 0 }])
48
+ }, r(n), 3))), 128)),
49
+ e.canRemoveRow ? (o(), t("div", k)) : d("", !0)
50
+ ])) : d("", !0),
51
+ u(b(y), {
52
+ "model-value": e.rows,
53
+ "onUpdate:modelValue": e.onDragUpdate,
54
+ disabled: !e.draggable || e.disabled || e.readonly,
55
+ animation: 150,
56
+ handle: ".drag-handle",
57
+ "ghost-class": "opacity-50",
58
+ class: "divide-y divide-border min-w-0"
59
+ }, {
60
+ default: w(() => [
61
+ (o(!0), t(l, null, i(e.rows, (n, a) => (o(), g(h, {
62
+ key: n._id,
63
+ row: n,
64
+ "row-index": a,
65
+ fields: e.visibleSchemaFields,
66
+ draggable: e.draggable,
67
+ disabled: e.disabled,
68
+ readonly: e.readonly,
69
+ "is-update": e.isUpdate,
70
+ "show-row-numbers": e.showRowNumbers,
71
+ "can-remove-row": e.canRemoveRow,
72
+ helpers: e.helpers,
73
+ "on-field-change": e.onFieldChange,
74
+ "on-remove-row": e.onRemoveRow
75
+ }, null, 8, ["row", "row-index", "fields", "draggable", "disabled", "readonly", "is-update", "show-row-numbers", "can-remove-row", "helpers", "on-field-change", "on-remove-row"]))), 128))
76
+ ]),
77
+ _: 1
78
+ }, 8, ["model-value", "onUpdate:modelValue", "disabled"]),
79
+ e.rows.length === 0 ? (o(), t("div", B, [
80
+ s("p", F, r(e.emptyTitle), 1),
81
+ s("p", V, r(e.emptyDescription), 1)
82
+ ])) : d("", !0)
83
+ ]));
84
+ }
85
+ });
86
+ export {
87
+ S as default
88
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./TableView.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,52 @@
1
+ import { ComputedRef, ShallowRef } from 'vue';
2
+ import { IForm, IFormFieldChangePayload } from '../types';
3
+ export type CustomFieldRow = Record<string, any> & {
4
+ _id: string;
5
+ };
6
+ /**
7
+ * Getters for each reactive prop the composable needs to read. The pattern
8
+ * is the same one useFileProcessing uses: we receive a function for each
9
+ * prop rather than the value, so the composable's `watch`es and `computed`s
10
+ * can read the current value at evaluation time. If we captured the values
11
+ * by snapshot, the `watch` source `() => options.modelValue` would always
12
+ * evaluate to the same value and never fire on parent updates.
13
+ */
14
+ export interface UseCustomFieldRowsGetters {
15
+ /** Schema for creating empty rows */
16
+ schema: () => IForm[];
17
+ /** Two-way bound value (clean — without _id) */
18
+ modelValue: () => Record<string, any>[];
19
+ /** Field name in the parent form (used for nested value resolution) */
20
+ name: () => string | undefined;
21
+ /** Full form values for `updateValues` context */
22
+ values: () => Record<string, any> | undefined;
23
+ isUpdate: () => boolean;
24
+ disabled: () => boolean;
25
+ readonly: () => boolean;
26
+ minRows: () => number;
27
+ maxRows: () => number;
28
+ }
29
+ export interface UseCustomFieldRowsReturn {
30
+ /** Rows with internal `_id` for stable v-for keys */
31
+ rows: ShallowRef<CustomFieldRow[]>;
32
+ canAddRow: ComputedRef<boolean>;
33
+ canRemoveRow: ComputedRef<boolean>;
34
+ getFieldValue: (rowIndex: number, fieldName: string) => any;
35
+ addRow: () => void;
36
+ removeRow: (index: number) => void;
37
+ handleFieldChange: (rowIndex: number, fieldName: string, payload: IFormFieldChangePayload) => Promise<void>;
38
+ handleDragUpdate: (newRows: CustomFieldRow[]) => void;
39
+ }
40
+ /**
41
+ * Owns the row state and the add/remove/change/drag operations for the
42
+ * CustomFields repeater.
43
+ *
44
+ * Two-way bound `modelValue` is the public surface (clean rows, no `_id`).
45
+ * Internally we use a `shallowRef` of rows augmented with `_id` for stable
46
+ * v-for keys and accordion toggling. The watch on `modelValue` reconciles
47
+ * external updates while preserving the `_id` of rows that are still present.
48
+ */
49
+ export declare const useCustomFieldRows: (get: UseCustomFieldRowsGetters, emit: {
50
+ (e: "update:modelValue", value: Record<string, any>[]): void;
51
+ (e: "change", value: Record<string, any>[]): void;
52
+ }) => UseCustomFieldRowsReturn;
@@ -0,0 +1,77 @@
1
+ import { shallowRef as y, watch as b, computed as f } from "vue";
2
+ import { setNestedValue as C } from "../utils/form.utils.js";
3
+ const v = () => `row_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`, E = (l, c) => {
4
+ const o = y([]), p = () => {
5
+ const e = {};
6
+ for (const a of l.schema()) {
7
+ const s = typeof a.value == "function" ? a.value() : a.value;
8
+ let t = null;
9
+ (a.props?.multiple || a.type === "multiSelect" || a.type === "tags") && (t = []), e[a.name] = s ?? t;
10
+ }
11
+ return { ...e, _id: v() };
12
+ }, w = (e) => e.map(({ _id: a, ...s }) => s), u = (e) => {
13
+ const a = w(e);
14
+ c("update:modelValue", a), c("change", a);
15
+ };
16
+ b(
17
+ () => l.modelValue(),
18
+ (e) => {
19
+ Array.isArray(e) ? o.value = e.map((a, s) => {
20
+ const t = o.value[s];
21
+ return {
22
+ ...a,
23
+ _id: t?._id || v()
24
+ };
25
+ }) : o.value = [];
26
+ },
27
+ { immediate: !0, deep: !0 }
28
+ );
29
+ const h = f(() => !(l.disabled() || l.readonly() || l.maxRows() && o.value.length >= l.maxRows())), R = f(() => l.disabled() || l.readonly() ? !1 : o.value.length > l.minRows());
30
+ return {
31
+ rows: o,
32
+ canAddRow: h,
33
+ canRemoveRow: R,
34
+ getFieldValue: (e, a) => o.value[e]?.[a],
35
+ addRow: () => {
36
+ if (l.disabled() || l.readonly() || l.maxRows() && o.value.length >= l.maxRows()) return;
37
+ const e = [...o.value, p()];
38
+ o.value = e, u(e);
39
+ },
40
+ removeRow: (e) => {
41
+ if (l.disabled() || l.readonly() || o.value.length <= l.minRows()) return;
42
+ const a = [...o.value];
43
+ a.splice(e, 1), o.value = a, u(a);
44
+ },
45
+ handleFieldChange: async (e, a, s) => {
46
+ const t = [...o.value];
47
+ t[e] = {
48
+ ...t[e],
49
+ [a]: s.value
50
+ };
51
+ const r = l.schema().find((n) => n.name === a);
52
+ if (r && r.updateValues)
53
+ try {
54
+ const n = t[e], V = l.values() || {}, m = l.name();
55
+ let d = { ...V };
56
+ m && (d = C(d, m, t));
57
+ const i = await r.updateValues({
58
+ value: s.value,
59
+ values: n,
60
+ globalValues: d,
61
+ data: s.data,
62
+ isUpdate: l.isUpdate()
63
+ });
64
+ i && typeof i == "object" && (t[e] = { ...t[e], ...i });
65
+ } catch (n) {
66
+ console.error(`[CustomFields] Error in updateValues for ${a}:`, n);
67
+ }
68
+ o.value = t, u(t);
69
+ },
70
+ handleDragUpdate: (e) => {
71
+ o.value = e, u(e);
72
+ }
73
+ };
74
+ };
75
+ export {
76
+ E as useCustomFieldRows
77
+ };
@@ -1,7 +1,7 @@
1
1
  export { default as Form } from './Form.vue';
2
2
  export { default as FormField } from './FormField.vue';
3
3
  export { default as FormFields } from './FormFields.vue';
4
- export { default as CustomFields } from './CustomFields.vue';
4
+ export { default as CustomFields } from './index.vue';
5
5
  export { default as FormSkeleton } from './FormSkeleton.vue';
6
6
  export * from './types';
7
7
  export { useForm } from './composables/useForm';
@@ -18,11 +18,11 @@ interface Props {
18
18
  label?: string;
19
19
  labelI18n?: string;
20
20
  showRowNumbers?: boolean;
21
- /** All form values for context */
22
21
  values?: Record<string, any>;
23
- /** Form Validation errors passed down */
24
22
  errors?: Record<string, string>;
25
23
  isUpdate?: boolean;
24
+ layout?: 'table' | 'accordion';
25
+ accordionTitleKey?: string;
26
26
  }
27
27
  declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
28
28
  change: (value: Record<string, any>[]) => any;
@@ -36,13 +36,16 @@ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, imp
36
36
  rounded: InputRounded;
37
37
  readonly: boolean;
38
38
  disabled: boolean;
39
+ layout: "table" | "accordion";
39
40
  isUpdate: boolean;
40
41
  modelValue: Record<string, any>[];
41
42
  draggable: boolean;
43
+ errors: Record<string, string>;
44
+ showRowNumbers: boolean;
45
+ accordionTitleKey: string;
42
46
  headers: string[];
43
47
  minRows: number;
48
+ maxRows: number;
44
49
  addButtonText: string;
45
- showRowNumbers: boolean;
46
- errors: Record<string, string>;
47
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
50
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
48
51
  export default _default;
@@ -0,0 +1,7 @@
1
+ import o from "./index.vue2.js";
2
+ /* empty css */
3
+ import t from "../../_virtual/_plugin-vue_export-helper.js";
4
+ const r = /* @__PURE__ */ t(o, [["__scopeId", "data-v-27f884e3"]]);
5
+ export {
6
+ r as default
7
+ };
@@ -0,0 +1,141 @@
1
+ import { defineComponent as b, computed as d, openBlock as n, createElementBlock as g, createElementVNode as R, createBlock as r, withCtx as x, createTextVNode as k, toDisplayString as I, createCommentVNode as w, unref as t } from "vue";
2
+ import B from "./TableView.vue.js";
3
+ import C from "./AccordionView.vue.js";
4
+ import F from "../Label.vue.js";
5
+ import U from "../Button.vue.js";
6
+ import { useCustomFieldRows as N } from "./composables/useCustomFieldRows.js";
7
+ import { createRowHelpers as T } from "./rowHelpers.js";
8
+ import { $t as s } from "../../utils/i18n.js";
9
+ const V = { class: "custom-fields-wrapper min-w-0 w-full" }, D = { class: "flex justify-between items-center mb-2" }, O = /* @__PURE__ */ b({
10
+ name: "CustomFields",
11
+ __name: "index",
12
+ props: {
13
+ name: {},
14
+ modelValue: { default: () => [] },
15
+ schema: {},
16
+ headers: { default: () => [] },
17
+ variant: { default: "outline" },
18
+ size: { default: "md" },
19
+ rounded: { default: "md" },
20
+ disabled: { type: Boolean, default: !1 },
21
+ readonly: { type: Boolean, default: !1 },
22
+ draggable: { type: Boolean, default: !1 },
23
+ minRows: { default: 0 },
24
+ maxRows: { default: 0 },
25
+ addButtonText: { default: "Add Row" },
26
+ textI18n: {},
27
+ label: {},
28
+ labelI18n: {},
29
+ showRowNumbers: { type: Boolean, default: !1 },
30
+ values: {},
31
+ errors: { default: () => ({}) },
32
+ isUpdate: { type: Boolean, default: !1 },
33
+ layout: { default: "table" },
34
+ accordionTitleKey: { default: void 0 }
35
+ },
36
+ emits: ["update:modelValue", "change"],
37
+ setup(a, { emit: v }) {
38
+ const e = a, p = v, i = d(() => e.labelI18n ? s(e.labelI18n) : e.label), m = d(() => {
39
+ const o = s("vlite.customFields.emptyTitle");
40
+ return o !== "vlite.customFields.emptyTitle" ? o : "No items added";
41
+ }), u = d(() => {
42
+ const o = s("vlite.customFields.emptyDescription");
43
+ return o !== "vlite.customFields.emptyDescription" ? o : "Add a new item to get started";
44
+ }), l = N(
45
+ {
46
+ // Getters (not snapshots) — see the long-form note in the composable
47
+ // file. The `watch(() => options.modelValue, ...)` source must
48
+ // evaluate to a fresh value on each tick so it fires when the parent
49
+ // updates `modelValue` (e.g. via a Form-level reset or external
50
+ // values load).
51
+ schema: () => e.schema,
52
+ modelValue: () => e.modelValue,
53
+ name: () => e.name,
54
+ values: () => e.values,
55
+ isUpdate: () => e.isUpdate,
56
+ disabled: () => e.disabled,
57
+ readonly: () => e.readonly,
58
+ minRows: () => e.minRows,
59
+ maxRows: () => e.maxRows
60
+ },
61
+ p
62
+ ), c = d(() => e.headers && e.headers.length > 0 ? e.headers : e.schema.map((o) => o.labelI18n ? s(o.labelI18n) : typeof o.label == "string" ? o.label : o.name)), h = d(() => e.schema.slice(0, c.value.length)), f = d(
63
+ () => T({
64
+ rows: l.rows.value,
65
+ schema: e.schema,
66
+ name: e.name,
67
+ values: e.values,
68
+ isUpdate: e.isUpdate,
69
+ errors: e.errors
70
+ })
71
+ ), y = d(() => e.labelI18n ? s(e.labelI18n) : e.label ? e.label : "Item");
72
+ return (o, z) => (n(), g("div", V, [
73
+ R("div", D, [
74
+ i.value ? (n(), r(F, {
75
+ key: 0,
76
+ class: "text-sm font-medium text-foreground"
77
+ }, {
78
+ default: x(() => [
79
+ k(I(i.value), 1)
80
+ ]),
81
+ _: 1
82
+ })) : w("", !0),
83
+ a.readonly ? w("", !0) : (n(), r(U, {
84
+ key: 1,
85
+ type: "button",
86
+ variant: "outline",
87
+ size: "xs",
88
+ rounded: "full",
89
+ "as-icon": "",
90
+ icon: "lucide:plus",
91
+ disabled: !t(l).canAddRow.value,
92
+ onClick: t(l).addRow
93
+ }, null, 8, ["disabled", "onClick"]))
94
+ ]),
95
+ a.layout === "table" ? (n(), r(B, {
96
+ key: 0,
97
+ rows: t(l).rows.value,
98
+ schema: e.schema,
99
+ "column-headers": c.value,
100
+ "visible-schema-fields": h.value,
101
+ draggable: a.draggable,
102
+ disabled: a.disabled,
103
+ readonly: a.readonly,
104
+ "is-update": a.isUpdate,
105
+ "show-row-numbers": a.showRowNumbers,
106
+ "can-remove-row": t(l).canRemoveRow.value,
107
+ "can-add-row": t(l).canAddRow.value,
108
+ helpers: f.value,
109
+ "empty-title": m.value,
110
+ "empty-description": u.value,
111
+ "on-field-change": t(l).handleFieldChange,
112
+ "on-remove-row": t(l).removeRow,
113
+ "on-drag-update": t(l).handleDragUpdate
114
+ }, null, 8, ["rows", "schema", "column-headers", "visible-schema-fields", "draggable", "disabled", "readonly", "is-update", "show-row-numbers", "can-remove-row", "can-add-row", "helpers", "empty-title", "empty-description", "on-field-change", "on-remove-row", "on-drag-update"])) : (n(), r(C, {
115
+ key: 1,
116
+ rows: t(l).rows.value,
117
+ schema: e.schema,
118
+ draggable: a.draggable,
119
+ disabled: a.disabled,
120
+ readonly: a.readonly,
121
+ "is-update": a.isUpdate,
122
+ variant: a.variant,
123
+ size: a.size,
124
+ rounded: a.rounded,
125
+ "can-remove-row": t(l).canRemoveRow.value,
126
+ "can-add-row": t(l).canAddRow.value,
127
+ helpers: f.value,
128
+ "accordion-title-key": a.accordionTitleKey,
129
+ "item-name": y.value,
130
+ "empty-title": m.value,
131
+ "empty-description": u.value,
132
+ "on-field-change": t(l).handleFieldChange,
133
+ "on-remove-row": t(l).removeRow,
134
+ "on-drag-update": t(l).handleDragUpdate
135
+ }, null, 8, ["rows", "schema", "draggable", "disabled", "readonly", "is-update", "variant", "size", "rounded", "can-remove-row", "can-add-row", "helpers", "accordion-title-key", "item-name", "empty-title", "empty-description", "on-field-change", "on-remove-row", "on-drag-update"]))
136
+ ]));
137
+ }
138
+ });
139
+ export {
140
+ O as default
141
+ };
@@ -0,0 +1,45 @@
1
+ import { IForm } from './types';
2
+ import { CustomFieldRow } from './composables/useCustomFieldRows';
3
+ import { Component } from 'vue';
4
+ export type { CustomFieldRow } from './composables/useCustomFieldRows';
5
+ export interface RowContext {
6
+ values: Record<string, any>;
7
+ globalValues: Record<string, any>;
8
+ isUpdate: boolean;
9
+ }
10
+ export interface RowHelpers {
11
+ /** All form errors keyed by dot-path (e.g. "team.0.name") */
12
+ errors: Record<string, string>;
13
+ /** Lookup a row's cell value by row index + field name. */
14
+ getFieldValue: (rowIndex: number, fieldName: string) => any;
15
+ /** Build the form-context object for a row (used by `when`, `updateValues`, etc.). */
16
+ getRowContext: (rowIndex: number) => RowContext;
17
+ /** Resolved type string (for dynamic-type schemas). */
18
+ getResolvedType: (field: IForm, rowIndex: number) => string | Component | undefined;
19
+ /** Whether the field should render at all in this row. */
20
+ isFieldVisible: (rowIndex: number, field: IForm) => boolean;
21
+ /** Whether the field is disabled (schema disabled OR props disabled). */
22
+ isFieldDisabled: (rowIndex: number, field: IForm) => boolean;
23
+ /** Whether the field is readonly (schema readonly OR props readonly). */
24
+ isFieldReadonly: (rowIndex: number, field: IForm) => boolean;
25
+ /** A short hash of all error messages for the row (used in v-memo). */
26
+ getRowErrorsHash: (rowIndex: number) => string;
27
+ /** Look up the per-cell error message for this row. */
28
+ getFieldError: (rowIndex: number, fieldName: string) => string;
29
+ /** Whether this row has any errors at all. */
30
+ hasRowErrors: (rowIndex: number) => boolean;
31
+ }
32
+ export declare const createRowHelpers: (params: {
33
+ rows: CustomFieldRow[];
34
+ schema: IForm[];
35
+ name?: string;
36
+ values?: Record<string, any>;
37
+ isUpdate: boolean;
38
+ errors: Record<string, string>;
39
+ }) => RowHelpers;
40
+ /**
41
+ * Render a label that may be a string or a Vue Component. Components are
42
+ * marked raw to skip the reactivity proxy — they're typically inline
43
+ * presentational components from the schema author.
44
+ */
45
+ export declare const renderLabel: (label: string | Component | undefined) => string | Component | undefined;
@@ -0,0 +1,40 @@
1
+ import { evaluateConditional as l, resolveFieldType as h, setNestedValue as m } from "./utils/form.utils.js";
2
+ import { markRaw as y } from "vue";
3
+ const x = (s) => {
4
+ const { rows: u, name: i, values: c, isUpdate: d, errors: o } = s, p = (r, e) => u[r]?.[e], n = (r) => {
5
+ let e = { ...c || {} };
6
+ return i && (e = m(e, i, u)), {
7
+ values: u[r] || {},
8
+ globalValues: e,
9
+ isUpdate: d
10
+ };
11
+ }, f = (r, e) => h(r, n(e)), w = (r, e) => l(e.disabled, n(r)), g = (r, e) => l(e.readonly, n(r)), R = (r, e) => e.when ? l(e.when, n(r)) : !0, a = (r) => i ? `${i}.${r}.` : null;
12
+ return {
13
+ errors: o,
14
+ getFieldValue: p,
15
+ getRowContext: n,
16
+ getResolvedType: f,
17
+ isFieldVisible: R,
18
+ isFieldDisabled: w,
19
+ isFieldReadonly: g,
20
+ getRowErrorsHash: (r) => {
21
+ const e = a(r);
22
+ return e ? Object.keys(o).filter((t) => t.startsWith(e)).map((t) => o[t]).join(",") : "";
23
+ },
24
+ getFieldError: (r, e) => {
25
+ const t = a(r);
26
+ return t && o[`${t}${e}`] || "";
27
+ },
28
+ hasRowErrors: (r) => {
29
+ const e = a(r);
30
+ return e ? Object.keys(o).some((t) => t.startsWith(e)) : !1;
31
+ }
32
+ };
33
+ }, $ = (s) => {
34
+ if (s)
35
+ return typeof s != "string" ? y(s) : s;
36
+ };
37
+ export {
38
+ x as createRowHelpers,
39
+ $ as renderLabel
40
+ };
@@ -83,6 +83,9 @@ export interface IFormCustomFieldsProps {
83
83
  schema: IForm[];
84
84
  headers?: string[];
85
85
  draggable?: boolean;
86
+ layout?: 'table' | 'accordion';
87
+ accordionTitleKey?: string;
88
+ addButtonText?: string;
86
89
  }
87
90
  /**
88
91
  * Layout for grouped schemas (schema: IForm[][]).
@@ -21,12 +21,12 @@ declare function __VLS_template(): {
21
21
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
22
22
  declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
23
23
  onSelect: (value: string, svg: string) => any;
24
- onClose: () => any;
25
24
  onTrigger: () => any;
25
+ onClose: () => any;
26
26
  }, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
27
27
  onOnSelect?: (value: string, svg: string) => any;
28
- onOnClose?: () => any;
29
28
  onOnTrigger?: () => any;
29
+ onOnClose?: () => any;
30
30
  }>, {
31
31
  value: string;
32
32
  position: TooltTipPlacement;
@@ -13,6 +13,7 @@ interface Props {
13
13
  headerClass?: string;
14
14
  footerClass?: string;
15
15
  body?: Component;
16
+ styles?: any;
16
17
  bodyProps?: Record<string, any>;
17
18
  }
18
19
  declare function __VLS_template(): {
@@ -46,6 +47,7 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {},
46
47
  maxWidth: string;
47
48
  closeOutside: boolean;
48
49
  backdrop: boolean;
50
+ styles: any;
49
51
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
50
52
  modalRef: HTMLDivElement;
51
53
  }, any>;