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