vlite3 1.4.5 → 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.
- package/components/AppShell/AppShellLayoutStorefront.vue.d.ts +4 -17
- package/components/AppShell/AppShellLayoutStorefront.vue.js +116 -152
- package/components/AvatarUploader/AvatarUploader.vue.d.ts +1 -1
- package/components/AvatarUploader/AvatarUploader.vue.js +1 -1
- package/components/CategoryManager/CategoryManager.vue2.js +1 -1
- package/components/Chat/ChatInterface.vue.js +1 -1
- package/components/Comment/CommentEditor.vue.js +1 -1
- package/components/FilePicker/FilePickerDropzone.vue.d.ts +27 -0
- package/components/FilePicker/FilePickerDropzone.vue.js +117 -0
- package/components/FilePicker/FilePickerDropzone.vue2.js +4 -0
- package/components/FilePicker/FilePickerInput.vue.d.ts +22 -0
- package/components/FilePicker/FilePickerInput.vue.js +147 -0
- package/components/FilePicker/FilePickerInput.vue2.js +4 -0
- package/components/FilePicker/FilePreview.vue.d.ts +21 -0
- package/components/FilePicker/FilePreview.vue.js +95 -0
- package/components/FilePicker/FilePreview.vue2.js +4 -0
- package/components/FilePicker/composables/useFileProcessing.d.ts +65 -0
- package/components/FilePicker/composables/useFileProcessing.js +141 -0
- package/components/FilePicker/index.d.ts +2 -2
- package/components/FilePicker/{FilePicker.vue.d.ts → index.vue.d.ts} +11 -18
- package/components/FilePicker/index.vue.js +131 -0
- package/components/FilePicker/index.vue2.js +4 -0
- package/components/FilePicker/types.d.ts +17 -0
- package/components/FilePicker/utils.d.ts +23 -0
- package/components/FilePicker/utils.js +37 -0
- package/components/Form/AccordionView.vue.d.ts +26 -0
- package/components/Form/AccordionView.vue.js +219 -0
- package/components/Form/AccordionView.vue2.js +4 -0
- package/components/Form/FormField.vue.js +2 -2
- package/components/Form/FormFields.vue.js +2 -2
- package/components/Form/TableRow.vue.d.ts +18 -0
- package/components/Form/TableRow.vue.js +88 -0
- package/components/Form/TableRow.vue2.js +4 -0
- package/components/Form/TableView.vue.d.ts +23 -0
- package/components/Form/TableView.vue.js +88 -0
- package/components/Form/TableView.vue2.js +4 -0
- package/components/Form/composables/useCustomFieldRows.d.ts +52 -0
- package/components/Form/composables/useCustomFieldRows.js +77 -0
- package/components/Form/index.d.ts +1 -1
- package/components/Form/{CustomFields.vue.d.ts → index.vue.d.ts} +5 -6
- package/components/Form/index.vue.js +7 -0
- package/components/Form/index.vue2.js +141 -0
- package/components/Form/rowHelpers.d.ts +45 -0
- package/components/Form/rowHelpers.js +40 -0
- package/components/IconPicker.vue.d.ts +2 -2
- package/components/Screen/ScreenFilter.vue.js +1 -1
- package/components/ThumbnailSelector/ThumbnailSelector.vue.js +1 -1
- package/components/ThumbnailSelector/ThumbnailSelector.vue2.js +1 -1
- package/components/index.d.ts +1 -1
- package/index.js +2 -2
- package/package.json +1 -1
- package/style.css +1 -1
- package/components/FilePicker/FilePicker.vue.js +0 -437
- package/components/FilePicker/FilePicker.vue2.js +0 -4
- package/components/Form/CustomFields.vue.js +0 -7
- package/components/Form/CustomFields.vue2.js +0 -465
|
@@ -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,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 './
|
|
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,9 +18,7 @@ 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;
|
|
26
24
|
layout?: 'table' | 'accordion';
|
|
@@ -42,11 +40,12 @@ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, imp
|
|
|
42
40
|
isUpdate: boolean;
|
|
43
41
|
modelValue: Record<string, any>[];
|
|
44
42
|
draggable: boolean;
|
|
43
|
+
errors: Record<string, string>;
|
|
44
|
+
showRowNumbers: boolean;
|
|
45
|
+
accordionTitleKey: string;
|
|
45
46
|
headers: string[];
|
|
46
47
|
minRows: number;
|
|
48
|
+
maxRows: number;
|
|
47
49
|
addButtonText: string;
|
|
48
|
-
|
|
49
|
-
errors: Record<string, string>;
|
|
50
|
-
accordionTitleKey: string;
|
|
51
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
50
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
52
51
|
export default _default;
|
|
@@ -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
|
+
};
|
|
@@ -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;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./ThumbnailSelector.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-
|
|
4
|
+
const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-470fec5b"]]);
|
|
5
5
|
export {
|
|
6
6
|
p as default
|
|
7
7
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as L, ref as w, watch as k, computed as m, openBlock as i, createElementBlock as d, toDisplayString as p, createCommentVNode as g, createElementVNode as v, createVNode as f, unref as P, withCtx as _, Fragment as V, renderList as F, normalizeClass as S, withModifiers as C, createBlock as y } from "vue";
|
|
2
2
|
import h from "../Icon.vue.js";
|
|
3
|
-
import M from "../FilePicker/
|
|
3
|
+
import M from "../FilePicker/index.vue.js";
|
|
4
4
|
import { VueDraggable as O } from "vue-draggable-plus";
|
|
5
5
|
import { $t as z } from "../../utils/i18n.js";
|
|
6
6
|
const q = ["data-testid"], G = {
|
package/components/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export { Chip } from './Chip';
|
|
|
17
17
|
export { ChoiceBox } from './ChoiceBox';
|
|
18
18
|
export { ColorPicker } from './ColorPicker';
|
|
19
19
|
export { default as ConfirmationModal } from './ConfirmationModal.vue';
|
|
20
|
-
export {
|
|
20
|
+
export { CustomFields } from './Form';
|
|
21
21
|
export { DataList } from './DataList';
|
|
22
22
|
export { List } from './List';
|
|
23
23
|
export { DataTable } from './DataTable';
|
package/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { default as ae } from "./components/Chip/Chip.vue.js";
|
|
|
9
9
|
import { default as me } from "./components/Form/Form.vue.js";
|
|
10
10
|
import { default as pe } from "./components/Form/FormField.vue.js";
|
|
11
11
|
import { default as ue } from "./components/Form/FormFields.vue.js";
|
|
12
|
-
import { default as xe } from "./components/Form/
|
|
12
|
+
import { default as xe } from "./components/Form/index.vue.js";
|
|
13
13
|
import { default as ne } from "./components/Form/FormSkeleton.vue.js";
|
|
14
14
|
import { useForm as Ce } from "./components/Form/composables/useForm.js";
|
|
15
15
|
import { useFileUpload as Te } from "./components/Form/composables/useFileUpload.js";
|
|
@@ -80,7 +80,7 @@ import { SCREEN_CONTEXT_KEY as Yt } from "./components/DataTable/types.js";
|
|
|
80
80
|
import { default as zt } from "./components/Splitter/Splitter.vue.js";
|
|
81
81
|
import { default as Ht } from "./components/Footer/Footer.vue.js";
|
|
82
82
|
import { initializeTheme as Wt, useTheme as Xt } from "./composables/useTheme.js";
|
|
83
|
-
import { default as qt } from "./components/FilePicker/
|
|
83
|
+
import { default as qt } from "./components/FilePicker/index.vue.js";
|
|
84
84
|
import { default as Jt } from "./components/Pagination/Pagination.vue.js";
|
|
85
85
|
import { default as er } from "./components/ExportData/ExportData.vue.js";
|
|
86
86
|
import { default as tr } from "./components/ImportData/ImportData.vue.js";
|