@bach.software/vue-dynamic-form 0.2.0 → 0.4.0
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 +163 -163
- package/dist/examples.cjs.js +5 -5
- package/dist/examples.cjs.js.map +1 -1
- package/dist/examples.es.js +356 -270
- package/dist/examples.es.js.map +1 -1
- package/dist/src/components/DynamicForm.vue.d.ts +3 -0
- package/dist/src/components/DynamicFormItem.vue.d.ts +6 -1
- package/dist/src/components/DynamicFormItemArray.vue.d.ts +5 -1
- package/dist/src/components/DynamicFormItemChoice.vue.d.ts +5 -1
- package/dist/src/components/DynamicFormTemplate.vue.d.ts +34 -36
- package/dist/src/core/__tests__/validation.test.d.ts +1 -0
- package/dist/src/core/defineMetadata.d.ts +22 -10
- package/dist/src/core/useDynamicForm.d.ts +10 -0
- package/dist/src/core/useFieldArrayExtended.d.ts +2 -1
- package/dist/src/core/useValidatePartialForm.d.ts +12 -0
- package/dist/src/core/validation.d.ts +1 -0
- package/dist/src/examples/TestForm.vue.d.ts +5 -2
- package/dist/src/examples/TestFormTemplate.vue.d.ts +33 -27
- package/dist/src/examples/{TestFormTemplate.testcases.d.ts → __tests__/TestFormTemplate.testcases.d.ts} +8 -3
- package/dist/src/examples/index.d.ts +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/types/DynamicFormItemProps.d.ts +1 -4
- package/dist/src/types/DynamicFormSettings.d.ts +3 -3
- package/dist/src/types/FieldMetadata.d.ts +24 -2
- package/dist/src/types/GetDynamicFormSettingsType.d.ts +3 -0
- package/dist/src/types/InternalFieldMetadata.d.ts +7 -1
- package/dist/src/types/MetadataConfiguration.d.ts +2 -0
- package/dist/src/utils/__tests__/createValidation.test.d.ts +1 -0
- package/dist/src/utils/__tests__/mapEachMetadataItem.test.d.ts +17 -0
- package/dist/src/utils/hashField.d.ts +7 -0
- package/dist/src/utils/mapEachMetadataItem.d.ts +10 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/useDynamicForm-B3VHKage.js +735 -0
- package/dist/useDynamicForm-B3VHKage.js.map +1 -0
- package/dist/useDynamicForm-CIS8GwHy.cjs +6 -0
- package/dist/useDynamicForm-CIS8GwHy.cjs.map +1 -0
- package/dist/vue-dynamic-form.cjs.js +1 -1
- package/dist/vue-dynamic-form.es.js +9 -11
- package/package.json +1 -1
- package/dist/src/core/validation.test.d.ts +0 -1
- package/dist/src/types/KeyValue.d.ts +0 -3
- package/dist/src/utils/createValidation.test.d.ts +0 -1
- package/dist/useDynamicForm-3E1RNkVq.cjs +0 -6
- package/dist/useDynamicForm-3E1RNkVq.cjs.map +0 -1
- package/dist/useDynamicForm-B6YN35Qb.js +0 -684
- package/dist/useDynamicForm-B6YN35Qb.js.map +0 -1
- /package/dist/src/components/{DynamicForm.test.d.ts → __tests__/DynamicForm.test.d.ts} +0 -0
- /package/dist/src/components/{DynamicFormItem.analytics.test.d.ts → __tests__/DynamicFormItem.analytics.test.d.ts} +0 -0
- /package/dist/src/components/{DynamicFormItem.logic.test.d.ts → __tests__/DynamicFormItem.logic.test.d.ts} +0 -0
- /package/dist/src/components/{DynamicFormItem.test-helpers.d.ts → __tests__/DynamicFormItem.test-helpers.d.ts} +0 -0
- /package/dist/src/components/{DynamicFormItem.validation.test.d.ts → __tests__/DynamicFormItem.validation.test.d.ts} +0 -0
- /package/dist/src/components/{DynamicFormItemArray.logic.test.d.ts → __tests__/DynamicFormItemArray.logic.test.d.ts} +0 -0
- /package/dist/src/components/{DynamicFormItemArray.validation.test.d.ts → __tests__/DynamicFormItemArray.validation.test.d.ts} +0 -0
- /package/dist/src/components/{DynamicFormItemChoice.logic.test.d.ts → __tests__/DynamicFormItemChoice.logic.test.d.ts} +0 -0
- /package/dist/src/components/{DynamicFormItemChoice.validation.test.d.ts → __tests__/DynamicFormItemChoice.validation.test.d.ts} +0 -0
- /package/dist/src/{examples/DynamicForm.test.d.ts → core/__tests__/useValidatePartialForm.test.d.ts} +0 -0
- /package/dist/src/{test-setup.d.ts → tests/test-setup.d.ts} +0 -0
- /package/dist/src/utils/{checkTreeHasValue.test.d.ts → __tests__/checkTreeHasValue.test.d.ts} +0 -0
- /package/dist/src/utils/{normalizePath.test.d.ts → __tests__/normalizePath.test.d.ts} +0 -0
- /package/dist/src/utils/{overridePath.test.d.ts → __tests__/overridePath.test.d.ts} +0 -0
- /package/dist/src/utils/{resolveMessage.test.d.ts → __tests__/resolveMessage.test.d.ts} +0 -0
- /package/dist/src/utils/{setInPath.test.d.ts → __tests__/setInPath.test.d.ts} +0 -0
- /package/dist/src/utils/{splitValidationFunctions.test.d.ts → __tests__/splitValidationFunctions.test.d.ts} +0 -0
package/dist/examples.es.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { defineComponent as B, createElementBlock as l, openBlock as t, normalizeClass as
|
|
2
|
-
import { d as
|
|
3
|
-
|
|
1
|
+
import { defineComponent as B, createElementBlock as l, openBlock as t, normalizeClass as y, createCommentVNode as s, createElementVNode as r, createBlock as O, unref as k, withCtx as x, withDirectives as W, vModelText as I, vModelCheckbox as R, Fragment as F, renderList as T, toDisplayString as u, vModelSelect as A, renderSlot as v, createTextVNode as w, createVNode as q, ref as V, computed as L, withModifiers as U, markRaw as j, h as P } from "vue";
|
|
2
|
+
import { d as z, e as G, u as H, _ as J, h as Y } from "./useDynamicForm-B3VHKage.js";
|
|
3
|
+
function S(h, f) {
|
|
4
|
+
return !h || !f || (h = f?.({ ...h }), h.children = h?.children?.map((c) => S(c, f)), h.choice = h?.choice?.map((c) => S(c, f))), h;
|
|
5
|
+
}
|
|
6
|
+
const Q = {
|
|
4
7
|
key: 0,
|
|
5
8
|
xmlns: "http://www.w3.org/2000/svg",
|
|
6
9
|
fill: "none",
|
|
@@ -8,7 +11,7 @@ const G = {
|
|
|
8
11
|
"stroke-width": "1.5",
|
|
9
12
|
stroke: "currentColor",
|
|
10
13
|
class: "size-3"
|
|
11
|
-
},
|
|
14
|
+
}, X = {
|
|
12
15
|
key: 1,
|
|
13
16
|
xmlns: "http://www.w3.org/2000/svg",
|
|
14
17
|
fill: "none",
|
|
@@ -16,351 +19,395 @@ const G = {
|
|
|
16
19
|
"stroke-width": "1.5",
|
|
17
20
|
stroke: "currentColor",
|
|
18
21
|
class: "size-3"
|
|
19
|
-
},
|
|
22
|
+
}, C = /* @__PURE__ */ B({
|
|
20
23
|
__name: "IconButton",
|
|
21
24
|
props: {
|
|
22
25
|
icon: {},
|
|
23
26
|
color: { default: "blue" }
|
|
24
27
|
},
|
|
25
28
|
emits: ["click"],
|
|
26
|
-
setup(
|
|
27
|
-
return (
|
|
29
|
+
setup(h) {
|
|
30
|
+
return (f, c) => (t(), l("button", {
|
|
28
31
|
type: "button",
|
|
29
|
-
class:
|
|
30
|
-
"bg-blue-200 hover:bg-blue-300":
|
|
31
|
-
"bg-red-200 hover:bg-red-300":
|
|
32
|
+
class: y(["cursor-pointer inline-flex items-center justify-center rounded-full size-5 text-white-800 cursor-pointer", {
|
|
33
|
+
"bg-blue-200 hover:bg-blue-300": f.color === "blue",
|
|
34
|
+
"bg-red-200 hover:bg-red-300": f.color === "red"
|
|
32
35
|
}]),
|
|
33
|
-
onClick:
|
|
36
|
+
onClick: c[0] || (c[0] = (N) => f.$emit("click"))
|
|
34
37
|
}, [
|
|
35
|
-
|
|
36
|
-
|
|
38
|
+
f.icon === "plus" ? (t(), l("svg", Q, c[1] || (c[1] = [
|
|
39
|
+
r("path", {
|
|
37
40
|
"stroke-linecap": "round",
|
|
38
41
|
"stroke-linejoin": "round",
|
|
39
42
|
d: "M12 4.5v15m7.5-7.5h-15"
|
|
40
43
|
}, null, -1)
|
|
41
|
-
]))) :
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
]))) : s("", !0),
|
|
45
|
+
f.icon === "minus" ? (t(), l("svg", X, c[2] || (c[2] = [
|
|
46
|
+
r("path", {
|
|
44
47
|
"stroke-linecap": "round",
|
|
45
48
|
"stroke-linejoin": "round",
|
|
46
49
|
d: "M5 12h14"
|
|
47
50
|
}, null, -1)
|
|
48
|
-
]))) :
|
|
51
|
+
]))) : s("", !0)
|
|
49
52
|
], 2));
|
|
50
53
|
}
|
|
51
|
-
}),
|
|
54
|
+
}), Z = { class: "text-sm whitespace-pre-wrap" }, K = ["data-testid"], M = { class: "grid grid-cols-1 md:grid-cols-2 gap-6" }, ee = {
|
|
55
|
+
key: 0,
|
|
56
|
+
class: "text-red-500 dark:text-rose-400"
|
|
57
|
+
}, te = {
|
|
58
|
+
key: 1,
|
|
59
|
+
class: "text-sm text-gray-400"
|
|
60
|
+
}, le = { class: "grid grid-cols-1 md:grid-cols-2 gap-6 ms-6" }, se = { class: "text-sm whitespace-pre-wrap" }, ie = ["data-testid"], ne = ["for"], oe = {
|
|
52
61
|
key: 0,
|
|
53
|
-
class: "-
|
|
54
|
-
},
|
|
62
|
+
class: "text-red-500 dark:text-rose-400"
|
|
63
|
+
}, de = {
|
|
64
|
+
key: 1,
|
|
65
|
+
class: "text-sm text-gray-400"
|
|
66
|
+
}, ae = { class: "text-sm whitespace-pre-wrap" }, re = ["data-testid"], ue = ["for"], ce = {
|
|
55
67
|
key: 0,
|
|
56
|
-
class: "-
|
|
57
|
-
},
|
|
68
|
+
class: "text-red-500 dark:text-rose-400"
|
|
69
|
+
}, pe = {
|
|
70
|
+
key: 1,
|
|
71
|
+
class: "text-sm text-gray-400"
|
|
72
|
+
}, he = { class: "flex gap-2 items-center" }, me = { class: "flex flex-col grow" }, fe = { class: "text-sm whitespace-pre-wrap" }, be = ["data-testid"], ge = {
|
|
58
73
|
key: 0,
|
|
59
|
-
class: "-
|
|
60
|
-
},
|
|
74
|
+
class: "text-red-500 dark:text-rose-400"
|
|
75
|
+
}, ye = {
|
|
76
|
+
key: 1,
|
|
77
|
+
class: "text-sm text-gray-400"
|
|
78
|
+
}, xe = { class: "grid grid-cols-1 md:grid-cols-2 gap-6 ms-6" }, ve = { class: "text-sm whitespace-pre-wrap" }, ke = ["data-testid"], _e = {
|
|
61
79
|
key: 0,
|
|
62
|
-
class: "-
|
|
63
|
-
},
|
|
80
|
+
class: "text-red-500 dark:text-rose-400"
|
|
81
|
+
}, Oe = {
|
|
82
|
+
key: 1,
|
|
83
|
+
class: "text-sm text-gray-400"
|
|
84
|
+
}, Ce = { class: "grid grid-cols-1 md:grid-cols-2 gap-6 ms-6" }, we = { class: "text-sm whitespace-pre-wrap" }, $e = ["data-testid"], Ne = ["id", "value", "disabled", "onChange", "onBlur"], Fe = ["value"], Be = ["id", "onUpdate:modelValue", "disabled", "onBlur"], We = ["value"], Ve = ["id", "checked", "disabled", "onChange", "onBlur"], Te = ["id", "onUpdate:modelValue", "disabled", "onBlur"], Se = ["id", "onUpdate:modelValue", "disabled", "onBlur"], Ee = ["id", "value", "disabled", "onInput", "onBlur"], Le = /* @__PURE__ */ B({
|
|
64
85
|
__name: "TestFormTemplate",
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
o("div", {
|
|
73
|
-
class: m(["mt-4", { "md:col-span-2": e.fullWidth }])
|
|
86
|
+
setup(h) {
|
|
87
|
+
const f = G();
|
|
88
|
+
return (c, N) => (t(), O(z, { "metadata-configuration": k(f) }, {
|
|
89
|
+
heading: x(({ fieldMetadata: e, fieldContext: { errorMessage: i, label: n }, disabled: d, canAddItems: o, addItem: p, canRemoveItems: b, removeItem: m, slotProps: a }) => [
|
|
90
|
+
e.hidden ? s("", !0) : (t(), l("div", {
|
|
91
|
+
key: 0,
|
|
92
|
+
class: y(["mt-4", { "md:col-span-2": e.fullWidth }])
|
|
74
93
|
}, [
|
|
75
|
-
|
|
94
|
+
n ? (t(), l("h3", {
|
|
76
95
|
key: 0,
|
|
77
|
-
class:
|
|
96
|
+
class: y(["flex text-xl font-bold gap-2 items-center mb-2", { "text-gray-500": e.disabled || d }])
|
|
78
97
|
}, [
|
|
79
|
-
w(
|
|
80
|
-
|
|
98
|
+
w(u(n) + " ", 1),
|
|
99
|
+
o ? (t(), O(C, {
|
|
81
100
|
key: 0,
|
|
82
101
|
icon: "plus",
|
|
83
102
|
tabindex: "-1",
|
|
84
103
|
"data-testid": `${e.path}-add-button`,
|
|
85
|
-
onClick:
|
|
86
|
-
}, null, 8, ["data-testid", "onClick"])) :
|
|
87
|
-
|
|
104
|
+
onClick: p
|
|
105
|
+
}, null, 8, ["data-testid", "onClick"])) : s("", !0),
|
|
106
|
+
b ? (t(), O(C, {
|
|
88
107
|
key: 1,
|
|
89
108
|
icon: "minus",
|
|
90
109
|
tabindex: "-1",
|
|
91
110
|
color: "red",
|
|
92
111
|
"data-testid": `${e.path}-remove-button`,
|
|
93
|
-
onClick:
|
|
94
|
-
}, null, 8, ["data-testid", "onClick"])) :
|
|
95
|
-
], 2)) :
|
|
96
|
-
|
|
97
|
-
|
|
112
|
+
onClick: m
|
|
113
|
+
}, null, 8, ["data-testid", "onClick"])) : s("", !0)
|
|
114
|
+
], 2)) : s("", !0),
|
|
115
|
+
r("pre", Z, u(e.description), 1),
|
|
116
|
+
i.value ? (t(), l("span", {
|
|
98
117
|
key: 1,
|
|
99
118
|
class: "text-red-600 text-sm",
|
|
100
119
|
"data-testid": `${e.path}-error-message`
|
|
101
|
-
},
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
level: (
|
|
120
|
+
}, u(i.value), 9, K)) : s("", !0),
|
|
121
|
+
r("div", M, [
|
|
122
|
+
v(c.$slots, "default", {
|
|
123
|
+
level: (a?.level ?? 0) + 1
|
|
105
124
|
})
|
|
106
125
|
])
|
|
107
|
-
], 2)
|
|
126
|
+
], 2))
|
|
108
127
|
]),
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
class: m(["flex flex-col gap-2", { "md:col-span-2": e.fullWidth }])
|
|
112
|
-
}, [
|
|
113
|
-
o("span", {
|
|
114
|
-
class: m(["flex gap-2 items-center", { "text-gray-500": d, "after:content-['*'] after:-ml-0.5 after:text-red-500": r }])
|
|
115
|
-
}, a(i), 3),
|
|
116
|
-
o("div", X, [
|
|
117
|
-
y(u.$slots, "default", {
|
|
118
|
-
level: (u.slotProps?.level ?? 0) + 1,
|
|
119
|
-
belowChoiceField: !0
|
|
120
|
-
})
|
|
121
|
-
]),
|
|
122
|
-
o("pre", Z, a(e.description), 1),
|
|
123
|
-
s.value ? (t(), l("span", {
|
|
124
|
-
key: 0,
|
|
125
|
-
class: "text-red-600 text-sm",
|
|
126
|
-
"data-testid": `${e.path}-error-message`
|
|
127
|
-
}, a(s.value), 9, K)) : n("", !0)
|
|
128
|
-
], 2)
|
|
128
|
+
"heading-array": x(() => [
|
|
129
|
+
v(c.$slots, "default")
|
|
129
130
|
]),
|
|
130
|
-
|
|
131
|
-
|
|
131
|
+
"default-choice": x(({ fieldMetadata: e, fieldContext: { errorMessage: i, label: n }, disabled: d, required: o, slotProps: p, settings: { showOptionalInsteadOfRequired: b } }) => [
|
|
132
|
+
e.hidden ? s("", !0) : (t(), l("div", {
|
|
132
133
|
key: 0,
|
|
133
|
-
class:
|
|
134
|
+
class: y(["flex flex-col gap-2", { "md:col-span-2": e.fullWidth }])
|
|
134
135
|
}, [
|
|
135
|
-
|
|
136
|
-
class:
|
|
136
|
+
r("span", {
|
|
137
|
+
class: y(["flex gap-2 items-center", { "text-gray-500": d }])
|
|
137
138
|
}, [
|
|
138
|
-
w(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
key: 1,
|
|
142
|
-
icon: "plus",
|
|
143
|
-
tabindex: "-1",
|
|
144
|
-
"data-testid": `${e.path}-add-button`,
|
|
145
|
-
onClick: f
|
|
146
|
-
}, null, 8, ["data-testid", "onClick"])) : n("", !0)
|
|
139
|
+
w(u(n) + " ", 1),
|
|
140
|
+
o && !b ? (t(), l("span", ee, "*")) : s("", !0),
|
|
141
|
+
!o && b ? (t(), l("span", te, "(optional)")) : s("", !0)
|
|
147
142
|
], 2),
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
level: (
|
|
143
|
+
r("div", le, [
|
|
144
|
+
v(c.$slots, "default", {
|
|
145
|
+
level: (p?.level ?? 0) + 1,
|
|
146
|
+
belowChoiceField: !0
|
|
151
147
|
})
|
|
152
148
|
]),
|
|
153
|
-
|
|
154
|
-
|
|
149
|
+
r("pre", se, u(e.description), 1),
|
|
150
|
+
i.value ? (t(), l("span", {
|
|
155
151
|
key: 0,
|
|
156
152
|
class: "text-red-600 text-sm",
|
|
157
153
|
"data-testid": `${e.path}-error-message`
|
|
158
|
-
},
|
|
159
|
-
], 2))
|
|
160
|
-
|
|
161
|
-
|
|
154
|
+
}, u(i.value), 9, ie)) : s("", !0)
|
|
155
|
+
], 2))
|
|
156
|
+
]),
|
|
157
|
+
"default-array": x(({ fieldMetadata: e, fieldContext: { errorMessage: i, label: n }, disabled: d, required: o, canAddItems: p, addItem: b, settings: { showOptionalInsteadOfRequired: m } }) => [
|
|
158
|
+
e.hidden ? s("", !0) : (t(), l("div", {
|
|
159
|
+
key: 0,
|
|
160
|
+
class: y(["flex flex-col gap-2", { "md:col-span-2": e.fullWidth }])
|
|
162
161
|
}, [
|
|
163
|
-
|
|
162
|
+
r("label", {
|
|
164
163
|
for: `${e.path}[0]`,
|
|
165
|
-
class:
|
|
164
|
+
class: y([{ "text-gray-500": e.disabled || d }, "flex gap-2 items-center"])
|
|
166
165
|
}, [
|
|
167
|
-
w(
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
166
|
+
w(u(n) + " ", 1),
|
|
167
|
+
o && !m ? (t(), l("span", oe, "*")) : s("", !0),
|
|
168
|
+
!o && m ? (t(), l("span", de, "(optional)")) : s("", !0),
|
|
169
|
+
p ? (t(), O(C, {
|
|
170
|
+
key: 2,
|
|
171
171
|
icon: "plus",
|
|
172
172
|
tabindex: "-1",
|
|
173
173
|
"data-testid": `${e.path}-add-button`,
|
|
174
|
-
onClick:
|
|
175
|
-
}, null, 8, ["data-testid", "onClick"])) :
|
|
176
|
-
], 10,
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
174
|
+
onClick: b
|
|
175
|
+
}, null, 8, ["data-testid", "onClick"])) : s("", !0)
|
|
176
|
+
], 10, ne),
|
|
177
|
+
v(c.$slots, "default", { hideLabel: !0 }),
|
|
178
|
+
r("pre", ae, u(e.description), 1),
|
|
179
|
+
i.value ? (t(), l("span", {
|
|
180
180
|
key: 0,
|
|
181
181
|
class: "text-red-600 text-sm",
|
|
182
182
|
"data-testid": `${e.path}-error-message`
|
|
183
|
-
},
|
|
183
|
+
}, u(i.value), 9, re)) : s("", !0)
|
|
184
184
|
], 2))
|
|
185
185
|
]),
|
|
186
|
-
default: x(({ fieldMetadata: e, fieldContext: { errorMessage:
|
|
187
|
-
e.
|
|
186
|
+
default: x(({ fieldMetadata: e, fieldContext: { errorMessage: i, label: n }, disabled: d, required: o, canRemoveItems: p, removeItem: b, slotProps: m, settings: { showOptionalInsteadOfRequired: a } }) => [
|
|
187
|
+
e.hidden ? s("", !0) : (t(), l("div", {
|
|
188
188
|
key: 0,
|
|
189
|
-
class:
|
|
189
|
+
class: y(["flex flex-col gap-2", { "md:col-span-2": e.fullWidth }])
|
|
190
190
|
}, [
|
|
191
|
-
|
|
191
|
+
m?.hideLabel ? s("", !0) : (t(), l("label", {
|
|
192
192
|
key: 0,
|
|
193
|
-
|
|
193
|
+
for: e.path,
|
|
194
|
+
class: y([{ "text-gray-500": e.disabled || d }, "flex gap-1 items-center"])
|
|
194
195
|
}, [
|
|
195
|
-
w(
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
"
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
key: 2,
|
|
196
|
+
w(u(n) + " ", 1),
|
|
197
|
+
o && !a ? (t(), l("span", ce, "*")) : s("", !0),
|
|
198
|
+
!o && a ? (t(), l("span", pe, "(optional)")) : s("", !0)
|
|
199
|
+
], 10, ue)),
|
|
200
|
+
r("div", he, [
|
|
201
|
+
r("div", me, [
|
|
202
|
+
v(c.$slots, "default")
|
|
203
|
+
]),
|
|
204
|
+
q(C, {
|
|
205
|
+
class: y({ invisible: !p }),
|
|
206
206
|
icon: "minus",
|
|
207
207
|
tabindex: "-1",
|
|
208
|
-
"data-testid": `${e.path}-remove-button`,
|
|
209
208
|
color: "red",
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
o("div", re, [
|
|
214
|
-
y(u.$slots, "default", {
|
|
215
|
-
level: (u.slotProps?.level ?? 0) + 1
|
|
216
|
-
})
|
|
209
|
+
"data-testid": `${e.path}-remove-button`,
|
|
210
|
+
onClick: b
|
|
211
|
+
}, null, 8, ["class", "data-testid", "onClick"])
|
|
217
212
|
]),
|
|
218
|
-
|
|
219
|
-
|
|
213
|
+
r("pre", fe, u(e.description), 1),
|
|
214
|
+
i.value ? (t(), l("span", {
|
|
220
215
|
key: 1,
|
|
221
216
|
class: "text-red-600 text-sm",
|
|
222
217
|
"data-testid": `${e.path}-error-message`
|
|
223
|
-
},
|
|
224
|
-
], 2))
|
|
218
|
+
}, u(i.value), 9, be)) : s("", !0)
|
|
219
|
+
], 2)),
|
|
220
|
+
v(c.$slots, "attributes")
|
|
221
|
+
]),
|
|
222
|
+
"group-array": x(({ fieldMetadata: e, fieldContext: { errorMessage: i, label: n }, disabled: d, required: o, canAddItems: p, addItem: b, slotProps: m, settings: { showOptionalInsteadOfRequired: a } }) => [
|
|
223
|
+
e.hidden ? (t(), l(F, { key: 0 }, [], 64)) : m?.belowChoiceField ? (t(), l("div", {
|
|
225
224
|
key: 1,
|
|
226
|
-
class:
|
|
225
|
+
class: y({ "md:col-span-2": e.fullWidth })
|
|
227
226
|
}, [
|
|
228
|
-
|
|
227
|
+
r("span", {
|
|
228
|
+
class: y(["flex gap-2 items-center mb-2", { "text-gray-500": e.disabled || d }])
|
|
229
|
+
}, [
|
|
230
|
+
w(u(n) + " ", 1),
|
|
231
|
+
o && !a ? (t(), l("span", ge, "*")) : s("", !0),
|
|
232
|
+
!o && a ? (t(), l("span", ye, "(optional)")) : s("", !0),
|
|
233
|
+
p ? (t(), O(C, {
|
|
234
|
+
key: 2,
|
|
235
|
+
icon: "plus",
|
|
236
|
+
tabindex: "-1",
|
|
237
|
+
"data-testid": `${e.path}-add-button`,
|
|
238
|
+
onClick: b
|
|
239
|
+
}, null, 8, ["data-testid", "onClick"])) : s("", !0)
|
|
240
|
+
], 2),
|
|
241
|
+
r("div", xe, [
|
|
242
|
+
v(c.$slots, "default", {
|
|
243
|
+
level: (m?.level ?? 0) + 1
|
|
244
|
+
})
|
|
245
|
+
]),
|
|
246
|
+
r("pre", ve, u(e.description), 1),
|
|
247
|
+
i.value ? (t(), l("span", {
|
|
229
248
|
key: 0,
|
|
230
|
-
|
|
231
|
-
|
|
249
|
+
class: "text-red-600 text-sm",
|
|
250
|
+
"data-testid": `${e.path}-error-message`
|
|
251
|
+
}, u(i.value), 9, ke)) : s("", !0)
|
|
252
|
+
], 2)) : v(c.$slots, "default", { key: 2 })
|
|
253
|
+
]),
|
|
254
|
+
group: x(({ fieldMetadata: e, fieldContext: { errorMessage: i, label: n }, disabled: d, required: o, canAddItems: p, canRemoveItems: b, addItem: m, removeItem: a, slotProps: g, settings: { showOptionalInsteadOfRequired: _ } }) => [
|
|
255
|
+
e.hidden ? s("", !0) : (t(), l("div", {
|
|
256
|
+
key: 0,
|
|
257
|
+
class: y({ "md:col-span-2": e.fullWidth })
|
|
258
|
+
}, [
|
|
259
|
+
g?.hideLabel ? s("", !0) : (t(), l("span", {
|
|
260
|
+
key: 0,
|
|
261
|
+
class: y(["flex gap-2 items-center mb-2", { "text-gray-500": e.disabled || d }])
|
|
232
262
|
}, [
|
|
233
|
-
w(
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
263
|
+
w(u(n) + " ", 1),
|
|
264
|
+
o && !_ ? (t(), l("span", _e, "*")) : s("", !0),
|
|
265
|
+
!o && _ ? (t(), l("span", Oe, "(optional)")) : s("", !0),
|
|
266
|
+
p ? (t(), O(C, {
|
|
267
|
+
key: 2,
|
|
268
|
+
icon: "plus",
|
|
269
|
+
tabindex: "-1",
|
|
270
|
+
"data-testid": `${e.path}-add-button`,
|
|
271
|
+
onClick: m
|
|
272
|
+
}, null, 8, ["data-testid", "onClick"])) : s("", !0),
|
|
273
|
+
b ? (t(), O(C, {
|
|
274
|
+
key: 3,
|
|
242
275
|
icon: "minus",
|
|
243
276
|
tabindex: "-1",
|
|
244
|
-
color: "red",
|
|
245
277
|
"data-testid": `${e.path}-remove-button`,
|
|
246
|
-
|
|
247
|
-
|
|
278
|
+
color: "red",
|
|
279
|
+
onClick: a
|
|
280
|
+
}, null, 8, ["data-testid", "onClick"])) : s("", !0)
|
|
281
|
+
], 2)),
|
|
282
|
+
r("div", Ce, [
|
|
283
|
+
v(c.$slots, "default", {
|
|
284
|
+
level: (g?.level ?? 0) + 1
|
|
285
|
+
})
|
|
248
286
|
]),
|
|
249
|
-
|
|
250
|
-
|
|
287
|
+
r("pre", we, u(e.description), 1),
|
|
288
|
+
i.value ? (t(), l("span", {
|
|
251
289
|
key: 1,
|
|
252
290
|
class: "text-red-600 text-sm",
|
|
253
291
|
"data-testid": `${e.path}-error-message`
|
|
254
|
-
},
|
|
292
|
+
}, u(i.value), 9, $e)) : s("", !0)
|
|
255
293
|
], 2)),
|
|
256
|
-
|
|
294
|
+
v(c.$slots, "attributes")
|
|
257
295
|
]),
|
|
258
|
-
"select-input": x(({ fieldMetadata: e, fieldContext: { value:
|
|
259
|
-
|
|
296
|
+
"select-input": x(({ fieldMetadata: e, fieldContext: { value: i, handleBlur: n, handleChange: d }, disabled: o }) => [
|
|
297
|
+
r("select", {
|
|
260
298
|
id: e.path,
|
|
261
|
-
value:
|
|
262
|
-
disabled: e.disabled ||
|
|
299
|
+
value: i.value,
|
|
300
|
+
disabled: e.disabled || o,
|
|
263
301
|
class: "h-9 bg-gray-100 border-gray-200 border rounded px-3 text-sm",
|
|
264
302
|
onChange: d,
|
|
265
|
-
onBlur:
|
|
303
|
+
onBlur: n
|
|
266
304
|
}, [
|
|
267
|
-
(t(!0), l(
|
|
268
|
-
key:
|
|
269
|
-
value:
|
|
270
|
-
},
|
|
271
|
-
], 40,
|
|
305
|
+
(t(!0), l(F, null, T(e.options, ({ key: p, value: b }) => (t(), l("option", {
|
|
306
|
+
key: p,
|
|
307
|
+
value: p
|
|
308
|
+
}, u(b), 9, Fe))), 128))
|
|
309
|
+
], 40, Ne)
|
|
272
310
|
]),
|
|
273
|
-
"selectBoundByVModel-input": x(({ fieldMetadata: e, fieldContext: { value:
|
|
274
|
-
|
|
311
|
+
"selectBoundByVModel-input": x(({ fieldMetadata: e, fieldContext: { value: i, handleBlur: n }, disabled: d }) => [
|
|
312
|
+
W(r("select", {
|
|
275
313
|
id: e.path,
|
|
276
|
-
"onUpdate:modelValue": (
|
|
314
|
+
"onUpdate:modelValue": (o) => i.value = o,
|
|
277
315
|
disabled: e.disabled || d,
|
|
278
316
|
class: "h-9 bg-gray-100 border-gray-200 border rounded px-3 text-sm",
|
|
279
|
-
onBlur:
|
|
317
|
+
onBlur: n
|
|
280
318
|
}, [
|
|
281
|
-
(t(!0), l(
|
|
282
|
-
key:
|
|
283
|
-
value:
|
|
284
|
-
},
|
|
285
|
-
], 40,
|
|
286
|
-
[
|
|
319
|
+
(t(!0), l(F, null, T(e.options, ({ key: o, value: p }) => (t(), l("option", {
|
|
320
|
+
key: o,
|
|
321
|
+
value: o
|
|
322
|
+
}, u(p), 9, We))), 128))
|
|
323
|
+
], 40, Be), [
|
|
324
|
+
[A, i.value]
|
|
287
325
|
])
|
|
288
326
|
]),
|
|
289
|
-
"checkbox-input": x(({ fieldMetadata: e, fieldContext: { value:
|
|
290
|
-
|
|
327
|
+
"checkbox-input": x(({ fieldMetadata: e, fieldContext: { value: i, handleBlur: n, handleChange: d }, disabled: o }) => [
|
|
328
|
+
r("input", {
|
|
291
329
|
id: e.path,
|
|
292
|
-
checked:
|
|
293
|
-
disabled: e.disabled ||
|
|
330
|
+
checked: i.value,
|
|
331
|
+
disabled: e.disabled || o,
|
|
294
332
|
type: "checkbox",
|
|
295
333
|
class: "h-6 bg-gray-100 border-gray-200 border rounded px-3 text-sm",
|
|
296
|
-
onChange: (
|
|
297
|
-
onBlur:
|
|
298
|
-
}, null, 40,
|
|
334
|
+
onChange: (p) => d(p.target.checked),
|
|
335
|
+
onBlur: n
|
|
336
|
+
}, null, 40, Ve)
|
|
299
337
|
]),
|
|
300
|
-
"checkboxBoundByVModel-input": x(({ fieldMetadata: e, fieldContext: { value:
|
|
301
|
-
|
|
338
|
+
"checkboxBoundByVModel-input": x(({ fieldMetadata: e, fieldContext: { value: i, handleBlur: n }, disabled: d }) => [
|
|
339
|
+
W(r("input", {
|
|
302
340
|
id: e.path,
|
|
303
|
-
"onUpdate:modelValue": (
|
|
341
|
+
"onUpdate:modelValue": (o) => i.value = o,
|
|
304
342
|
disabled: e.disabled || d,
|
|
305
343
|
type: "checkbox",
|
|
306
344
|
class: "h-6 bg-gray-100 border-gray-200 border rounded px-3 text-sm",
|
|
307
|
-
onBlur:
|
|
308
|
-
}, null, 40,
|
|
309
|
-
[
|
|
345
|
+
onBlur: n
|
|
346
|
+
}, null, 40, Te), [
|
|
347
|
+
[R, i.value]
|
|
310
348
|
])
|
|
311
349
|
]),
|
|
312
|
-
"textBoundByVModel-input": x(({ fieldMetadata: e, fieldContext: { value:
|
|
313
|
-
|
|
350
|
+
"textBoundByVModel-input": x(({ fieldMetadata: e, fieldContext: { value: i, handleBlur: n }, disabled: d }) => [
|
|
351
|
+
W(r("input", {
|
|
314
352
|
id: e.path,
|
|
315
|
-
"onUpdate:modelValue": (
|
|
353
|
+
"onUpdate:modelValue": (o) => i.value = o,
|
|
316
354
|
disabled: e.disabled || d,
|
|
317
355
|
type: "text",
|
|
318
356
|
class: "h-9 bg-gray-100 border-gray-200 border rounded px-3 text-sm",
|
|
319
|
-
onBlur:
|
|
320
|
-
}, null, 40,
|
|
321
|
-
[
|
|
357
|
+
onBlur: n
|
|
358
|
+
}, null, 40, Se), [
|
|
359
|
+
[I, i.value]
|
|
322
360
|
])
|
|
323
361
|
]),
|
|
324
|
-
"default-input": x(({ fieldMetadata: e, fieldContext: { value:
|
|
325
|
-
|
|
362
|
+
"default-input": x(({ fieldMetadata: e, fieldContext: { value: i, handleBlur: n, handleChange: d }, disabled: o }) => [
|
|
363
|
+
r("input", {
|
|
326
364
|
id: e.path,
|
|
327
|
-
value:
|
|
328
|
-
disabled: e.disabled ||
|
|
365
|
+
value: i.value,
|
|
366
|
+
disabled: e.disabled || o,
|
|
329
367
|
type: "text",
|
|
330
368
|
class: "h-9 bg-gray-100 border-gray-200 border rounded px-3 text-sm",
|
|
331
369
|
onInput: d,
|
|
332
|
-
onBlur:
|
|
333
|
-
}, null, 40,
|
|
370
|
+
onBlur: n
|
|
371
|
+
}, null, 40, Ee)
|
|
334
372
|
]),
|
|
335
373
|
_: 3
|
|
336
374
|
}, 8, ["metadata-configuration"]));
|
|
337
375
|
}
|
|
338
|
-
}),
|
|
376
|
+
}), qe = { class: "flex justify-end gap-2" }, De = {
|
|
339
377
|
key: 1,
|
|
340
378
|
type: "submit",
|
|
341
379
|
class: "cursor-pointer mt-4 bg-blue-500 text-white px-4 py-2 rounded",
|
|
342
380
|
"data-testid": "submit"
|
|
343
|
-
},
|
|
381
|
+
}, Ie = {
|
|
344
382
|
key: 0,
|
|
345
383
|
"data-testid": "errors",
|
|
346
384
|
class: "col-12 text-red-600"
|
|
347
|
-
},
|
|
385
|
+
}, Re = ["innerHTML"], Ae = {
|
|
348
386
|
key: 1,
|
|
349
387
|
"data-testid": "isSubmitted"
|
|
350
|
-
},
|
|
388
|
+
}, Ue = {
|
|
351
389
|
key: 2,
|
|
352
390
|
class: "bg-gray-100 p-4 rounded-lg text-sm overflow-auto"
|
|
353
|
-
},
|
|
391
|
+
}, je = /* @__PURE__ */ B({
|
|
354
392
|
__name: "TestForm",
|
|
355
393
|
props: {
|
|
356
394
|
metadata: {},
|
|
357
395
|
settings: {},
|
|
358
|
-
showDebugState: { type: Boolean, default: !1 }
|
|
396
|
+
showDebugState: { type: Boolean, default: !1 },
|
|
397
|
+
initialEdit: { type: Boolean, default: !0 },
|
|
398
|
+
hideFieldsWithoutValue: { type: Boolean, default: !1 },
|
|
399
|
+
initialValues: {}
|
|
359
400
|
},
|
|
360
|
-
setup(
|
|
361
|
-
const { values:
|
|
362
|
-
|
|
363
|
-
}),
|
|
401
|
+
setup(h) {
|
|
402
|
+
const { values: f, handleSubmit: c, errors: N, meta: e } = H({
|
|
403
|
+
initialValues: h.initialValues
|
|
404
|
+
}), i = V(), n = V(h.initialEdit), d = V(!1), o = L(() => h.metadata?.map((m) => S(m, (a) => (a.computedProps = a.computedProps ?? [], a.computedProps.push((g) => {
|
|
405
|
+
n.value || (g.disabled = !0);
|
|
406
|
+
}), h.hideFieldsWithoutValue && (a.computedProps.push((g, _) => {
|
|
407
|
+
!n.value && !Y(_.value) && (g.hidden = !0);
|
|
408
|
+
}), a.computedProps.push((g, _, E) => {
|
|
409
|
+
!n.value && E.value.length > 0 && E.value.every((D) => D.hidden) && (g.hidden = !0);
|
|
410
|
+
})), a)))), p = L(() => ({
|
|
364
411
|
analytics: !0,
|
|
365
412
|
messages: {
|
|
366
413
|
required: "{field} is required",
|
|
@@ -379,72 +426,71 @@ const G = {
|
|
|
379
426
|
fractionDigits: "{field} may have at most {digits} decimal place(s)",
|
|
380
427
|
totalDigits: "{field} may have at most {digits} significant digit(s)"
|
|
381
428
|
},
|
|
382
|
-
...
|
|
429
|
+
...h.settings ?? {}
|
|
383
430
|
}));
|
|
384
|
-
function
|
|
385
|
-
|
|
386
|
-
(
|
|
387
|
-
d.value = !0;
|
|
431
|
+
function b(m) {
|
|
432
|
+
c(
|
|
433
|
+
(a) => {
|
|
434
|
+
d.value = !0, n.value = !1;
|
|
388
435
|
},
|
|
389
|
-
({ errors:
|
|
436
|
+
({ errors: a }) => {
|
|
390
437
|
d.value = !1;
|
|
391
438
|
}
|
|
392
|
-
)(
|
|
393
|
-
}
|
|
394
|
-
function k(p, c) {
|
|
395
|
-
return !p || !c || (p = c?.({ ...p }), p.children = p?.children?.map((g) => k(g, c)), p.choice = p?.choice?.map((g) => k(g, c))), p;
|
|
439
|
+
)(m);
|
|
396
440
|
}
|
|
397
|
-
return (
|
|
398
|
-
|
|
399
|
-
|
|
441
|
+
return (m, a) => (t(), l("form", {
|
|
442
|
+
onSubmit: U(b, ["prevent"])
|
|
443
|
+
}, [
|
|
444
|
+
r("div", qe, [
|
|
445
|
+
n.value ? s("", !0) : (t(), l("button", {
|
|
400
446
|
key: 0,
|
|
401
447
|
type: "button",
|
|
402
448
|
class: "cursor-pointer mt-4 bg-blue-500 text-white px-4 py-2 rounded",
|
|
403
449
|
"data-testid": "submit",
|
|
404
|
-
onClick:
|
|
450
|
+
onClick: a[0] || (a[0] = (g) => n.value = !0)
|
|
405
451
|
}, " Edit ")),
|
|
406
|
-
|
|
407
|
-
|
|
452
|
+
n.value ? (t(), l("button", De, " Submit ")) : s("", !0),
|
|
453
|
+
n.value ? (t(), l("button", {
|
|
408
454
|
key: 2,
|
|
409
455
|
type: "button",
|
|
410
456
|
class: "cursor-pointer mt-4 bg-gray-200 text-black px-4 py-2 rounded",
|
|
411
457
|
"data-testid": "cancel",
|
|
412
|
-
onClick:
|
|
413
|
-
}, " Cancel ")) :
|
|
458
|
+
onClick: a[1] || (a[1] = (g) => n.value = !1)
|
|
459
|
+
}, " Cancel ")) : s("", !0)
|
|
414
460
|
]),
|
|
415
|
-
Object.values(
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
(t(!0), l(
|
|
419
|
-
|
|
461
|
+
Object.values(k(N)).length ? (t(), l("div", Ie, [
|
|
462
|
+
a[3] || (a[3] = w(" Errors: ", -1)),
|
|
463
|
+
r("ul", null, [
|
|
464
|
+
(t(!0), l(F, null, T(k(N), (g, _) => (t(), l("li", { key: _ }, [
|
|
465
|
+
r("span", { innerHTML: g }, null, 8, Re)
|
|
420
466
|
]))), 128))
|
|
421
467
|
])
|
|
422
|
-
])) :
|
|
423
|
-
|
|
424
|
-
template:
|
|
425
|
-
metadata:
|
|
426
|
-
settings:
|
|
427
|
-
"onUpdate:modelValue":
|
|
468
|
+
])) : s("", !0),
|
|
469
|
+
q(J, {
|
|
470
|
+
template: Le,
|
|
471
|
+
metadata: o.value,
|
|
472
|
+
settings: p.value,
|
|
473
|
+
"onUpdate:modelValue": a[2] || (a[2] = (g) => i.value = g)
|
|
428
474
|
}, null, 8, ["metadata", "settings"]),
|
|
429
|
-
d.value ? (t(), l("span",
|
|
430
|
-
|
|
431
|
-
Pending: ` +
|
|
432
|
-
Touched: ` +
|
|
433
|
-
Valid: ` +
|
|
434
|
-
Submitted: ` +
|
|
475
|
+
d.value ? (t(), l("span", Ae)) : s("", !0),
|
|
476
|
+
m.showDebugState ? (t(), l("pre", Ue, "IsDirty: " + u(k(e).dirty) + `
|
|
477
|
+
Pending: ` + u(k(e).pending) + `
|
|
478
|
+
Touched: ` + u(k(e).touched) + `
|
|
479
|
+
Valid: ` + u(k(e).valid) + `
|
|
480
|
+
Submitted: ` + u(d.value) + `
|
|
435
481
|
|
|
436
482
|
// form values:
|
|
437
|
-
` +
|
|
438
|
-
`, 1)) :
|
|
483
|
+
` + u(JSON.stringify(k(f), null, 2)) + `
|
|
484
|
+
`, 1)) : s("", !0)
|
|
439
485
|
], 32));
|
|
440
486
|
}
|
|
441
|
-
}),
|
|
487
|
+
}), Ge = $([{
|
|
442
488
|
name: "text",
|
|
443
489
|
type: "text",
|
|
444
490
|
fieldOptions: { label: "Text Input" },
|
|
445
491
|
path: "with.custom.structure",
|
|
446
492
|
restriction: { maxLength: 10 }
|
|
447
|
-
}]),
|
|
493
|
+
}]), He = $([{
|
|
448
494
|
fieldOptions: { label: "Array Fields" },
|
|
449
495
|
type: "heading",
|
|
450
496
|
children: [
|
|
@@ -461,15 +507,15 @@ Submitted: ` + a(d.value) + `
|
|
|
461
507
|
{ fieldOptions: { label: "Nested field 3" }, type: "checkbox" }
|
|
462
508
|
] }
|
|
463
509
|
]
|
|
464
|
-
}]),
|
|
510
|
+
}]), Je = $([{
|
|
465
511
|
fieldOptions: { label: "Grouped Fields" },
|
|
466
512
|
type: "heading",
|
|
467
513
|
children: [
|
|
468
|
-
{ fieldOptions: { label: "Required group" }, children: [
|
|
514
|
+
{ fieldOptions: { label: "Required group" }, type: "group", children: [
|
|
469
515
|
{ fieldOptions: { label: "Required Nested field 1" }, fullWidth: !0 },
|
|
470
516
|
{ fieldOptions: { label: "Required Nested field 2" }, fullWidth: !0 }
|
|
471
517
|
] },
|
|
472
|
-
{ fieldOptions: { label: "Optional group" }, minOccurs: 0, description: `The group is optional, therefore the children will only be required once 1 value is filled in.
|
|
518
|
+
{ fieldOptions: { label: "Optional group" }, type: "group", minOccurs: 0, description: `The group is optional, therefore the children will only be required once 1 value is filled in.
|
|
473
519
|
|
|
474
520
|
You can test it by filling in one of the fields.`, children: [
|
|
475
521
|
{ fieldOptions: { label: "Required Nested field 1" }, fullWidth: !0 },
|
|
@@ -480,16 +526,16 @@ You can test it by filling in one of the fields.`, children: [
|
|
|
480
526
|
fieldOptions: { label: "Grouped Array Fields" },
|
|
481
527
|
type: "heading",
|
|
482
528
|
children: [
|
|
483
|
-
{ fieldOptions: { label: "Required group" }, maxOccurs: 5, fullWidth: !0, children: [
|
|
529
|
+
{ fieldOptions: { label: "Required group" }, type: "group", maxOccurs: 5, fullWidth: !0, children: [
|
|
484
530
|
{ fieldOptions: { label: "Required Nested field 1" } },
|
|
485
531
|
{ fieldOptions: { label: "Required Nested field 2" } }
|
|
486
532
|
] },
|
|
487
|
-
{ fieldOptions: { label: "Optional group" }, minOccurs: 0, maxOccurs: 5, fullWidth: !0, children: [
|
|
533
|
+
{ fieldOptions: { label: "Optional group" }, type: "group", minOccurs: 0, maxOccurs: 5, fullWidth: !0, children: [
|
|
488
534
|
{ fieldOptions: { label: "Required Nested field 1" } },
|
|
489
535
|
{ fieldOptions: { label: "Required Nested field 2" } }
|
|
490
536
|
] }
|
|
491
537
|
]
|
|
492
|
-
}]),
|
|
538
|
+
}]), Ye = $([
|
|
493
539
|
{
|
|
494
540
|
fieldOptions: { label: "Choice Fields (minOccurs 1, maxOccurs 1)" },
|
|
495
541
|
type: "heading",
|
|
@@ -504,9 +550,15 @@ You can test it by filling in one of the fields.`, children: [
|
|
|
504
550
|
fieldOptions: { label: "Choice Grouped Fields (minOccurs 1, maxOccurs 3)" },
|
|
505
551
|
type: "heading",
|
|
506
552
|
children: [
|
|
507
|
-
{ fieldOptions: { label: "Array Choice Field" }, maxOccurs: 3, fullWidth: !0, description: "In a choice field, only 1 of the fields can be filled in.", choice: [
|
|
508
|
-
{ fieldOptions: { label: "Nested Field 1" },
|
|
509
|
-
|
|
553
|
+
{ fieldOptions: { label: "Array Choice Field" }, type: "group", maxOccurs: 3, fullWidth: !0, description: "In a choice field, only 1 of the fields can be filled in.", choice: [
|
|
554
|
+
{ fieldOptions: { label: "Nested Field 1" }, type: "group", children: [
|
|
555
|
+
{ fieldOptions: { label: "Nested Child Field 1" }, fullWidth: !0 },
|
|
556
|
+
{ fieldOptions: { label: "Nested Child Field 2" }, fullWidth: !0 }
|
|
557
|
+
] },
|
|
558
|
+
{ fieldOptions: { label: "Nested Field 2" }, type: "group", children: [
|
|
559
|
+
{ fieldOptions: { label: "Nested Child Field 1" }, fullWidth: !0 },
|
|
560
|
+
{ fieldOptions: { label: "Nested Child Field 2" }, fullWidth: !0 }
|
|
561
|
+
] }
|
|
510
562
|
] }
|
|
511
563
|
]
|
|
512
564
|
},
|
|
@@ -514,13 +566,46 @@ You can test it by filling in one of the fields.`, children: [
|
|
|
514
566
|
fieldOptions: { label: "Choice Array Fields (minOccurs 1, maxOccurs 3)" },
|
|
515
567
|
type: "heading",
|
|
516
568
|
children: [
|
|
517
|
-
{ fieldOptions: { label: "Array Choice Field" }, maxOccurs: 3, fullWidth: !0, description: "In a choice field, only 1 of the fields can be filled in.", choice: [
|
|
569
|
+
{ fieldOptions: { label: "Array Choice Field" }, type: "group", maxOccurs: 3, fullWidth: !0, description: "In a choice field, only 1 of the fields can be filled in.", choice: [
|
|
518
570
|
{ fieldOptions: { label: "Nested Field 1" }, maxOccurs: 3 },
|
|
519
571
|
{ fieldOptions: { label: "Nested Field 2" }, maxOccurs: 3 }
|
|
520
572
|
] }
|
|
521
573
|
]
|
|
522
574
|
}
|
|
523
|
-
]),
|
|
575
|
+
]), Qe = $([
|
|
576
|
+
{
|
|
577
|
+
fieldOptions: { label: "Personal Info" },
|
|
578
|
+
type: "heading",
|
|
579
|
+
name: "person",
|
|
580
|
+
description: "Only showing the fields that have a value. Click edit to change.",
|
|
581
|
+
fullWidth: !0,
|
|
582
|
+
children: [
|
|
583
|
+
{ name: "firstName", fieldOptions: { label: "First Name" } },
|
|
584
|
+
{ name: "lastName", fieldOptions: { label: "Last Name" } },
|
|
585
|
+
{ name: "email", fieldOptions: { label: "Email" } }
|
|
586
|
+
]
|
|
587
|
+
},
|
|
588
|
+
{
|
|
589
|
+
fieldOptions: { label: "Address" },
|
|
590
|
+
type: "heading",
|
|
591
|
+
name: "address",
|
|
592
|
+
fullWidth: !0,
|
|
593
|
+
children: [
|
|
594
|
+
{ name: "street", fieldOptions: { label: "Street" }, minOccurs: 0 },
|
|
595
|
+
{ name: "city", fieldOptions: { label: "City" }, minOccurs: 0 },
|
|
596
|
+
{ name: "country", fieldOptions: { label: "Country" }, minOccurs: 0 }
|
|
597
|
+
]
|
|
598
|
+
}
|
|
599
|
+
], void 0, {
|
|
600
|
+
initialEdit: !1,
|
|
601
|
+
hideFieldsWithoutValue: !0,
|
|
602
|
+
initialValues: {
|
|
603
|
+
person: {
|
|
604
|
+
firstName: "Jack",
|
|
605
|
+
lastName: "Smit"
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
}), Xe = $(
|
|
524
609
|
[{
|
|
525
610
|
name: "items",
|
|
526
611
|
type: "text",
|
|
@@ -535,18 +620,19 @@ You can test it by filling in one of the fields.`, children: [
|
|
|
535
620
|
// validateOnBlur: true,
|
|
536
621
|
}
|
|
537
622
|
);
|
|
538
|
-
function $(
|
|
539
|
-
return
|
|
540
|
-
render: () =>
|
|
623
|
+
function $(h, f, c = {}) {
|
|
624
|
+
return j(B({
|
|
625
|
+
render: () => P(je, { ...c, metadata: h, settings: f, showDebugState: !0 })
|
|
541
626
|
}));
|
|
542
627
|
}
|
|
543
628
|
export {
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
629
|
+
Le as TestFormTemplate,
|
|
630
|
+
He as arrayTestCase,
|
|
631
|
+
Qe as childFieldsTestCase,
|
|
632
|
+
Ye as choiceTestCase,
|
|
547
633
|
$ as createTestCase,
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
634
|
+
Ge as defaultTestCase,
|
|
635
|
+
Je as groupTestCase,
|
|
636
|
+
Xe as individualTestCase
|
|
551
637
|
};
|
|
552
638
|
//# sourceMappingURL=examples.es.js.map
|