@digiform/wizard 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/src/types/guards.js +0 -12
- package/core/src/utils/apiBodyUtils.js +43 -75
- package/features/form-runtime/components/FormFooter.d.ts +5 -0
- package/features/form-runtime/hooks/useValidationEvents.d.ts +0 -1
- package/features/state-management/machines/formMachine.d.ts +3 -0
- package/features/state-management/machines/types.d.ts +4 -0
- package/features/state-management/machines/useFormMachine.d.ts +18 -0
- package/index.d.ts +2 -8
- package/index.js +2 -108
- package/package.json +1 -30
- package/styles.css +1 -1
- package/ui/src/lib/utils/templateUtils.js +11 -43
- package/wizard/src/features/api-integration/services/ApiCallService.js +65 -74
- package/wizard/src/features/dialog-system/components/ActionDialog/ActionDialog.js +39 -43
- package/wizard/src/features/dialog-system/components/ConfirmationDialog/ConfirmationDialog.js +37 -41
- package/wizard/src/features/dialog-system/components/EmailVerificationDialog/EmailVerificationDialog.js +44 -45
- package/wizard/src/features/form-runtime/FormWizard/FormWizard.js +56 -78
- package/wizard/src/features/form-runtime/components/FormField.js +28 -28
- package/wizard/src/features/form-runtime/components/FormFooter.js +53 -184
- package/wizard/src/features/form-runtime/components/FormSection/FormSection.js +152 -196
- package/wizard/src/features/form-runtime/components/FormStep/FormStep.js +82 -91
- package/wizard/src/features/form-runtime/components/StepProgressIndicator/StepProgressIndicator.js +24 -30
- package/wizard/src/features/form-runtime/config/configResolver.js +10 -14
- package/wizard/src/features/form-runtime/config/templateLoader.js +71 -108
- package/wizard/src/features/form-runtime/hooks/useComponentTriggers.js +45 -88
- package/wizard/src/features/form-runtime/hooks/useFieldEventHandlers.js +27 -41
- package/wizard/src/features/form-runtime/hooks/useFormFieldState.js +5 -5
- package/wizard/src/features/form-runtime/hooks/useValidationEvents.js +22 -25
- package/wizard/src/features/form-runtime/utils/errorUtils.js +31 -42
- package/wizard/src/features/form-runtime/utils/formDirtyStateSync.js +26 -37
- package/wizard/src/features/form-runtime/utils/logger.js +12 -12
- package/wizard/src/features/form-runtime/utils/validationUX.js +14 -55
- package/wizard/src/features/state-management/machines/actions/navigationActions.js +13 -8
- package/wizard/src/features/state-management/machines/componentTriggerEngine.js +167 -432
- package/wizard/src/features/state-management/machines/formMachine.js +558 -677
- package/wizard/src/features/state-management/machines/useFormMachine.js +172 -190
- package/wizard/src/features/trigger-action-system/components/ActionManager.js +35 -86
- package/wizard/src/features/validation-system/validation/SchemaBuilder.js +28 -82
- package/wizard/src/features/validation-system/validation/ValidationCache.js +11 -27
- package/wizard/src/features/validation-system/validation/ValidationEngine.js +24 -29
- package/wizard/src/features/validation-system/validation/ValidationExecutor.js +26 -58
- package/FormWizard.d.ts +0 -10
- package/core/src/types/api.js +0 -12
- package/core/src/types/form-config.js +0 -60
- package/core/src/types/form-wizard-config-schema.js +0 -113
- package/core/src/types/validation.js +0 -61
- package/features/api-integration.d.ts +0 -2
- package/features/api-integration.js +0 -17
- package/features/dialog-system.d.ts +0 -2
- package/features/dialog-system.js +0 -9
- package/features/form-runtime/utils/formSaver.d.ts +0 -22
- package/features/form-runtime.d.ts +0 -2
- package/features/form-runtime.js +0 -63
- package/features/index.d.ts +0 -11
- package/features/state-management/components/ValidationBuilder/ValidationBuilder.d.ts +0 -9
- package/features/state-management/machines/__tests__/setup.d.ts +0 -0
- package/features/state-management/machines/__tests__/vitest.config.d.ts +0 -2
- package/features/state-management/machines/actions/validationActions.d.ts +0 -68
- package/features/state-management/machines/lazyLoading.d.ts +0 -34
- package/features/state-management/machines/validation/index.d.ts +0 -5
- package/features/state-management/machines/validation/validateField.d.ts +0 -2
- package/features/state-management/machines/validation/validateForm.d.ts +0 -2
- package/features/state-management/machines/validation/validateSection.d.ts +0 -2
- package/features/state-management/machines/validation/validateStep.d.ts +0 -2
- package/features/state-management/machines/validation/validationTypes.d.ts +0 -1
- package/features/state-management.d.ts +0 -2
- package/features/state-management.js +0 -21
- package/features/trigger-action-system/components/FieldWarning/FieldWarning.d.ts +0 -20
- package/features/trigger-action-system.d.ts +0 -2
- package/features/trigger-action-system.js +0 -12
- package/features/validation-system.d.ts +0 -2
- package/features/validation-system.js +0 -23
- package/styles/index.d.ts +0 -0
- package/ui/src/components/badge/badge.js +0 -20
- package/ui/src/components/badge/badge.module.css.js +0 -12
- package/wizard/src/features/api-integration/services/ActionExecutor.js +0 -339
- package/wizard/src/features/api-integration/services/ApiCallExecutor.js +0 -6
- package/wizard/src/features/api-integration/services/DialogExecutor.js +0 -6
- package/wizard/src/features/api-integration/services/GenericTriggerService.js +0 -284
- package/wizard/src/features/api-integration/services/NavigationExecutor.js +0 -6
- package/wizard/src/features/form-runtime/config/templateConfig.js +0 -156
- package/wizard/src/features/form-runtime/config/templateUtils.js +0 -14
- package/wizard/src/features/form-runtime/utils/validation.js +0 -100
- package/wizard/src/features/trigger-action-system/components/ActionLoadingIndicator/ActionLoadingIndicator.js +0 -46
- package/wizard/src/features/trigger-action-system/components/ActionLoadingIndicator/ActionLoadingIndicator.module.css.js +0 -30
- package/wizard/src/features/trigger-action-system/utils/GenericTriggerEngine.js +0 -376
- package/wizard/src/features/validation-system/components/ValidationDebugger.js +0 -69
- package/wizard/src/features/validation-system/validation/tanstackSchemaAdapter.js +0 -17
- package/wizard/src/features/validation-system/validation/validationService.js +0 -74
|
@@ -1,209 +1,78 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { clsx as
|
|
2
|
+
import { jsx as h, jsxs as F } from "react/jsx-runtime";
|
|
3
|
+
import { clsx as b } from "clsx";
|
|
4
4
|
/* empty css */
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { Button as
|
|
9
|
-
const
|
|
10
|
-
navigation:
|
|
11
|
-
children:
|
|
12
|
-
isDisplayOnly:
|
|
13
|
-
onNext:
|
|
14
|
-
isLastStep:
|
|
5
|
+
import { useFormContext as S } from "../hooks/useFormContext.js";
|
|
6
|
+
import { useFormEditing as g } from "../../../../../ui/src/lib/providers/FormEditingContext.js";
|
|
7
|
+
import { useFormMachine as N } from "../../state-management/machines/useFormMachine.js";
|
|
8
|
+
import { Button as A } from "@rijkshuisstijl-community/components-react";
|
|
9
|
+
const I = ({
|
|
10
|
+
navigation: r,
|
|
11
|
+
children: a,
|
|
12
|
+
isDisplayOnly: e = !1,
|
|
13
|
+
onNext: c,
|
|
14
|
+
isLastStep: p = !1,
|
|
15
15
|
isDisabled: n = !1,
|
|
16
|
-
|
|
16
|
+
labels: i,
|
|
17
|
+
...o
|
|
17
18
|
}) => {
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
return /* @__PURE__ */
|
|
19
|
+
const l = () => {
|
|
20
|
+
e || n || c?.();
|
|
21
|
+
}, m = r?.next?.label || (p ? i?.finish ?? "Voltooien" : i?.next ?? "Volgende");
|
|
22
|
+
return /* @__PURE__ */ F(
|
|
22
23
|
"div",
|
|
23
24
|
{
|
|
24
|
-
className:
|
|
25
|
-
(n ||
|
|
26
|
-
|
|
25
|
+
className: b(
|
|
26
|
+
(n || e) && "opacity-50",
|
|
27
|
+
o.className
|
|
27
28
|
),
|
|
28
|
-
...
|
|
29
|
+
...o,
|
|
29
30
|
children: [
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
a,
|
|
32
|
+
r?.next?.enabled !== !1 && /* @__PURE__ */ h(
|
|
33
|
+
A,
|
|
33
34
|
{
|
|
34
35
|
appearance: "primary-action-button",
|
|
35
|
-
onClick:
|
|
36
|
-
disabled: n ||
|
|
37
|
-
children:
|
|
36
|
+
onClick: l,
|
|
37
|
+
disabled: n || e,
|
|
38
|
+
children: m
|
|
38
39
|
}
|
|
39
40
|
)
|
|
40
41
|
]
|
|
41
42
|
}
|
|
42
43
|
);
|
|
43
|
-
},
|
|
44
|
-
const { isEditing:
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
}, k = ({ children: r, labels: a, ...e }) => {
|
|
45
|
+
const { isEditing: c } = g(), [p, n, i] = N(), { currentStep: o, isLastStep: l, nextStep: m } = i, { navigation: u } = o, s = S(), x = () => {
|
|
46
|
+
const d = Object.keys(s.state.fieldMeta).filter((f) => {
|
|
47
|
+
const t = s.state.fieldMeta[f];
|
|
48
|
+
return !t.isValid && t.errors?.length > 0;
|
|
49
|
+
});
|
|
50
|
+
d.length > 0 && n({ type: "TRIGGER_STEP_VALIDATION", fieldIds: d });
|
|
51
|
+
};
|
|
52
|
+
return /* @__PURE__ */ h(
|
|
53
|
+
I,
|
|
47
54
|
{
|
|
48
|
-
navigation:
|
|
55
|
+
navigation: u,
|
|
49
56
|
onNext: async () => {
|
|
57
|
+
if (!s.state.canSubmit) {
|
|
58
|
+
x();
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const f = (o.actions ?? []).some((t) => t.trigger === "onStepFinish");
|
|
50
62
|
try {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
);
|
|
54
|
-
if (console.log("🔍 [FormFooter] Starting form submission check:", {
|
|
55
|
-
stepId: r.id,
|
|
56
|
-
stepActions: c.length,
|
|
57
|
-
hasFinishActions: h
|
|
58
|
-
}), h) {
|
|
59
|
-
const s = Object.keys(e.state.fieldMeta).map(
|
|
60
|
-
(t) => {
|
|
61
|
-
const o = e.state.fieldMeta[t], i = e.getFieldValue(t);
|
|
62
|
-
return {
|
|
63
|
-
fieldId: t,
|
|
64
|
-
value: i,
|
|
65
|
-
isValid: o.isValid,
|
|
66
|
-
isDirty: o.isDirty,
|
|
67
|
-
isTouched: o.isTouched,
|
|
68
|
-
errors: o.errors,
|
|
69
|
-
errorCount: o.errors?.length || 0
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
);
|
|
73
|
-
if (console.log(
|
|
74
|
-
"🔍 [FormFooter] Step has finish actions - checking form state:",
|
|
75
|
-
{
|
|
76
|
-
canSubmit: e.state.canSubmit,
|
|
77
|
-
isValid: e.state.isValid,
|
|
78
|
-
isSubmitting: e.state.isSubmitting,
|
|
79
|
-
fieldCount: Object.keys(e.state.fieldMeta).length,
|
|
80
|
-
fieldAnalysis: s,
|
|
81
|
-
formErrors: e.state.formErrors
|
|
82
|
-
}
|
|
83
|
-
), console.log("📋 [FormFooter] Detailed field analysis:"), s.forEach((t, o) => {
|
|
84
|
-
console.log(` Field ${o + 1}:`, {
|
|
85
|
-
fieldId: t.fieldId,
|
|
86
|
-
value: t.value,
|
|
87
|
-
isValid: t.isValid,
|
|
88
|
-
isDirty: t.isDirty,
|
|
89
|
-
isTouched: t.isTouched,
|
|
90
|
-
errors: t.errors,
|
|
91
|
-
errorCount: t.errorCount
|
|
92
|
-
});
|
|
93
|
-
}), e.state.canSubmit)
|
|
94
|
-
await e.handleSubmit();
|
|
95
|
-
else {
|
|
96
|
-
console.log(
|
|
97
|
-
"🚫 [FormFooter] Form validation failed for step with finish actions, triggering error display:",
|
|
98
|
-
{
|
|
99
|
-
canSubmit: e.state.canSubmit,
|
|
100
|
-
isValid: e.state.isValid,
|
|
101
|
-
isSubmitting: e.state.isSubmitting,
|
|
102
|
-
fieldMeta: e.state.fieldMeta,
|
|
103
|
-
formErrors: e.state.formErrors
|
|
104
|
-
}
|
|
105
|
-
);
|
|
106
|
-
const t = Object.keys(e.state.fieldMeta).filter(
|
|
107
|
-
(o) => {
|
|
108
|
-
const i = e.state.fieldMeta[o];
|
|
109
|
-
return !i.isValid && i.errors?.length > 0;
|
|
110
|
-
}
|
|
111
|
-
);
|
|
112
|
-
t.length > 0 && (console.log(
|
|
113
|
-
`🔍 [FormFooter] Triggering error display for ${t.length} invalid fields:`,
|
|
114
|
-
t
|
|
115
|
-
), window.dispatchEvent(
|
|
116
|
-
new CustomEvent("triggerStepValidation", {
|
|
117
|
-
detail: { fieldIds: t }
|
|
118
|
-
})
|
|
119
|
-
));
|
|
120
|
-
}
|
|
121
|
-
} else {
|
|
122
|
-
const s = Object.keys(e.state.fieldMeta).map(
|
|
123
|
-
(t) => {
|
|
124
|
-
const o = e.state.fieldMeta[t], i = e.getFieldValue(t);
|
|
125
|
-
return {
|
|
126
|
-
fieldId: t,
|
|
127
|
-
value: i,
|
|
128
|
-
isValid: o.isValid,
|
|
129
|
-
isDirty: o.isDirty,
|
|
130
|
-
isTouched: o.isTouched,
|
|
131
|
-
errors: o.errors,
|
|
132
|
-
errorCount: o.errors?.length || 0
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
);
|
|
136
|
-
if (console.log(
|
|
137
|
-
"🔍 [FormFooter] Step has no finish actions - checking form state:",
|
|
138
|
-
{
|
|
139
|
-
canSubmit: e.state.canSubmit,
|
|
140
|
-
isValid: e.state.isValid,
|
|
141
|
-
isSubmitting: e.state.isSubmitting,
|
|
142
|
-
fieldCount: Object.keys(e.state.fieldMeta).length,
|
|
143
|
-
fieldAnalysis: s,
|
|
144
|
-
formErrors: e.state.formErrors
|
|
145
|
-
}
|
|
146
|
-
), console.log("📋 [FormFooter] Detailed field analysis:"), s.forEach((t, o) => {
|
|
147
|
-
console.log(` Field ${o + 1}:`, {
|
|
148
|
-
fieldId: t.fieldId,
|
|
149
|
-
value: t.value,
|
|
150
|
-
isValid: t.isValid,
|
|
151
|
-
isDirty: t.isDirty,
|
|
152
|
-
isTouched: t.isTouched,
|
|
153
|
-
errors: t.errors,
|
|
154
|
-
errorCount: t.errorCount
|
|
155
|
-
});
|
|
156
|
-
}), e.state.canSubmit) {
|
|
157
|
-
const t = e.state.values, o = {};
|
|
158
|
-
console.log("🔄 [FormFooter] Preparing form values for navigation:", {
|
|
159
|
-
formValues: t,
|
|
160
|
-
fieldIds: Object.keys(t)
|
|
161
|
-
}), Object.keys(t).forEach((i) => {
|
|
162
|
-
const F = e.getFieldValue(i);
|
|
163
|
-
o[i] = F, console.log(`🔄 [FormFooter] Prepared field ${i}:`, F);
|
|
164
|
-
}), m({
|
|
165
|
-
type: "REQUEST_NAVIGATION",
|
|
166
|
-
navigationType: "next"
|
|
167
|
-
});
|
|
168
|
-
} else {
|
|
169
|
-
console.log(
|
|
170
|
-
"🚫 [FormFooter] Form cannot be submitted (validation failed or form is submitting), triggering error display:",
|
|
171
|
-
{
|
|
172
|
-
canSubmit: e.state.canSubmit,
|
|
173
|
-
isValid: e.state.isValid,
|
|
174
|
-
isSubmitting: e.state.isSubmitting,
|
|
175
|
-
fieldMeta: e.state.fieldMeta,
|
|
176
|
-
formErrors: e.state.formErrors,
|
|
177
|
-
values: e.state.values
|
|
178
|
-
}
|
|
179
|
-
);
|
|
180
|
-
const t = Object.keys(e.state.fieldMeta).filter(
|
|
181
|
-
(o) => {
|
|
182
|
-
const i = e.state.fieldMeta[o];
|
|
183
|
-
return !i.isValid && i.errors?.length > 0;
|
|
184
|
-
}
|
|
185
|
-
);
|
|
186
|
-
t.length > 0 && (console.log(
|
|
187
|
-
`🔍 [FormFooter] Triggering error display for ${t.length} invalid fields:`,
|
|
188
|
-
t
|
|
189
|
-
), window.dispatchEvent(
|
|
190
|
-
new CustomEvent("triggerStepValidation", {
|
|
191
|
-
detail: { fieldIds: t }
|
|
192
|
-
})
|
|
193
|
-
));
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
} catch (c) {
|
|
197
|
-
console.log("🚫 [FormFooter] Form submission failed:", c);
|
|
63
|
+
f ? await s.handleSubmit() : m();
|
|
64
|
+
} catch (t) {
|
|
65
|
+
console.error("Form submission failed:", t);
|
|
198
66
|
}
|
|
199
67
|
},
|
|
200
|
-
isLastStep:
|
|
201
|
-
isDisabled:
|
|
202
|
-
|
|
203
|
-
|
|
68
|
+
isLastStep: l,
|
|
69
|
+
isDisabled: c,
|
|
70
|
+
labels: a,
|
|
71
|
+
...e,
|
|
72
|
+
children: /* @__PURE__ */ h(s.Subscribe, { children: r })
|
|
204
73
|
}
|
|
205
74
|
);
|
|
206
75
|
};
|
|
207
76
|
export {
|
|
208
|
-
|
|
77
|
+
k as default
|
|
209
78
|
};
|