@digiform/wizard 0.2.18 → 0.3.1
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/index.d.ts +2 -8
- package/index.js +2 -108
- package/package.json +1 -28
- package/styles.css +1 -1
- package/ui/src/lib/utils/templateUtils.js +11 -43
- package/wizard/src/features/form-runtime/FormWizard/FormWizard.js +36 -33
- package/wizard/src/features/form-runtime/components/FormField.js +28 -28
- package/wizard/src/features/form-runtime/components/FormFooter.js +4 -4
- package/wizard/src/features/form-runtime/components/FormSection/FormSection.js +19 -19
- package/wizard/src/features/form-runtime/components/FormStep/FormStep.js +21 -21
- package/wizard/src/features/form-runtime/components/StepProgressIndicator/StepProgressIndicator.js +1 -1
- package/wizard/src/features/form-runtime/config/configResolver.js +10 -14
- package/wizard/src/features/form-runtime/config/templateLoader.js +82 -112
- package/wizard/src/features/form-runtime/hooks/useComponentTriggers.js +42 -66
- package/wizard/src/features/form-runtime/hooks/useFieldEventHandlers.js +3 -3
- package/wizard/src/features/form-runtime/hooks/useFormFieldState.js +5 -5
- package/wizard/src/features/form-runtime/utils/errorUtils.js +31 -42
- package/wizard/src/features/form-runtime/utils/validationUX.js +14 -55
- package/wizard/src/features/state-management/machines/useFormMachine.js +3 -3
- package/wizard/src/features/trigger-action-system/components/ActionManager.js +4 -4
- package/wizard/src/features/validation-system/validation/ValidationEngine.js +24 -29
- 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.d.ts +0 -2
- package/features/form-runtime.js +0 -63
- package/features/index.d.ts +0 -11
- package/features/state-management.d.ts +0 -2
- package/features/state-management.js +0 -21
- 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,29 +1,32 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as e, jsxs as l } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
import { ActionManager as M } from "../../trigger-action-system/components/ActionManager.js";
|
|
3
|
+
import { wizardDefaultRenderer as z } from "../../../renderer/wizardRenderer.js";
|
|
5
4
|
/* empty css */
|
|
6
|
-
import { FormLayout as
|
|
7
|
-
import { formWizardQueryClient as
|
|
8
|
-
import { QueryClientProvider as
|
|
5
|
+
import { FormLayout as m } from "../../../../../ui/src/components/FormLayout/FormLayout.js";
|
|
6
|
+
import { formWizardQueryClient as E } from "../../../../../ui/src/lib/queryClient.js";
|
|
7
|
+
import { QueryClientProvider as M } from "@tanstack/react-query";
|
|
9
8
|
import { clsx as g } from "clsx";
|
|
10
|
-
import { memo as
|
|
9
|
+
import { memo as N, useState as h, useEffect as w, useMemo as u } from "react";
|
|
11
10
|
import n from "./FormWizard.module.css.js";
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import { hasTemplateSteps as
|
|
15
|
-
import { ThemeProvider as
|
|
11
|
+
import W from "../components/FormStep/FormStep.js";
|
|
12
|
+
import L from "../components/StepProgressIndicator/StepProgressIndicator.js";
|
|
13
|
+
import { hasTemplateSteps as P, resolveFormWizardConfig as T } from "../config/configResolver.js";
|
|
14
|
+
import { ThemeProvider as I, useThemeConfig as x } from "../../../../../ui/src/theme/ThemeProvider.js";
|
|
15
|
+
import { useFormMachineProvider as b, FormMachineContext as U } from "../../state-management/machines/useFormMachine.js";
|
|
16
16
|
import j from "../../../../../ui/src/lib/error-boundaries/FormWizardErrorBoundary.js";
|
|
17
17
|
import { FormEditingProvider as O } from "../../../../../ui/src/lib/providers/FormEditingContext.js";
|
|
18
|
-
import
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
|
|
18
|
+
import s from "../../../../../ui/src/lib/error-boundaries/ComponentErrorBoundary.js";
|
|
19
|
+
import { ActionManager as R } from "../../trigger-action-system/components/ActionManager.js";
|
|
20
|
+
import { registerRenderComponent as V } from "../../../../../ui/src/component-registry/renderComponent.js";
|
|
21
|
+
import { ValidationEngine as k } from "../../validation-system/validation/ValidationEngine.js";
|
|
22
|
+
import { Heading as A } from "@rijkshuisstijl-community/components-react";
|
|
23
|
+
V(z);
|
|
24
|
+
const v = N(
|
|
22
25
|
({
|
|
23
26
|
config: r,
|
|
24
27
|
initialData: a = {},
|
|
25
|
-
onSubmit:
|
|
26
|
-
queryClient:
|
|
28
|
+
onSubmit: C,
|
|
29
|
+
queryClient: y = E
|
|
27
30
|
}) => {
|
|
28
31
|
console.log(
|
|
29
32
|
"🏁 [FormWizard] FormWizardCore component MOUNTING with config:",
|
|
@@ -40,11 +43,11 @@ const v = w(
|
|
|
40
43
|
);
|
|
41
44
|
}, 100);
|
|
42
45
|
const [t, d] = h(null), [c, f] = h(null);
|
|
43
|
-
|
|
46
|
+
w(() => {
|
|
44
47
|
(async () => {
|
|
45
48
|
try {
|
|
46
|
-
if (f(null),
|
|
47
|
-
const o = await
|
|
49
|
+
if (f(null), P(r)) {
|
|
50
|
+
const o = await T(r);
|
|
48
51
|
d(o);
|
|
49
52
|
} else
|
|
50
53
|
d(r);
|
|
@@ -60,7 +63,7 @@ const v = w(
|
|
|
60
63
|
"🚀 [FormWizard] Creating ValidationEngine with messageStyle:",
|
|
61
64
|
r.validationMessageStyle || "withLabel"
|
|
62
65
|
);
|
|
63
|
-
const i = new
|
|
66
|
+
const i = new k({
|
|
64
67
|
messageStyle: r.validationMessageStyle || "withLabel"
|
|
65
68
|
});
|
|
66
69
|
return console.log("✅ [FormWizard] ValidationEngine created:", {
|
|
@@ -77,31 +80,31 @@ const v = w(
|
|
|
77
80
|
schema: o.schema || p.getStepSchema(o)
|
|
78
81
|
};
|
|
79
82
|
})
|
|
80
|
-
} : null, [t, p]), F =
|
|
83
|
+
} : null, [t, p]), F = b({
|
|
81
84
|
config: S || r,
|
|
82
85
|
// Fallback to original config if resolution fails
|
|
83
86
|
initialData: a,
|
|
84
|
-
onSubmit:
|
|
87
|
+
onSubmit: C
|
|
85
88
|
});
|
|
86
89
|
return c ? /* @__PURE__ */ l("div", { className: g("form-wizard-error", n.errorState), children: [
|
|
87
90
|
/* @__PURE__ */ e("h3", { className: n.errorHeading, children: "Configuration Error" }),
|
|
88
91
|
/* @__PURE__ */ e("p", { children: c })
|
|
89
|
-
] }) : t ? /* @__PURE__ */ e(
|
|
90
|
-
/* @__PURE__ */ e(
|
|
91
|
-
/* @__PURE__ */ l(
|
|
92
|
-
/* @__PURE__ */ e(
|
|
93
|
-
/* @__PURE__ */ e(
|
|
94
|
-
/* @__PURE__ */ e(
|
|
92
|
+
] }) : t ? /* @__PURE__ */ e(M, { client: y, children: /* @__PURE__ */ e(j, { formId: r.id, children: /* @__PURE__ */ e(O, { children: /* @__PURE__ */ l(U.Provider, { value: F, children: [
|
|
93
|
+
/* @__PURE__ */ e(s, { componentName: "ActionManager", children: /* @__PURE__ */ e(R, {}) }),
|
|
94
|
+
/* @__PURE__ */ l(m, { className: n.formLayout, children: [
|
|
95
|
+
/* @__PURE__ */ e(m.Title, { children: /* @__PURE__ */ e(A, { level: 1, children: r.title }) }),
|
|
96
|
+
/* @__PURE__ */ e(m.LeftColumn, { children: /* @__PURE__ */ e(s, { componentName: "StepProgressIndicator", children: /* @__PURE__ */ e(L, {}) }) }),
|
|
97
|
+
/* @__PURE__ */ e(s, { componentName: "FormStep", children: /* @__PURE__ */ e(W, {}) })
|
|
95
98
|
] })
|
|
96
99
|
] }) }) }) }) : /* @__PURE__ */ e("div", { className: g("form-wizard-loading", n.loadingState), children: /* @__PURE__ */ e("div", { className: n.loadingPulse, children: "Loading form templates..." }) });
|
|
97
100
|
}
|
|
98
101
|
);
|
|
99
102
|
v.displayName = "FormWizardCore";
|
|
100
|
-
const
|
|
101
|
-
const a =
|
|
102
|
-
return /* @__PURE__ */ e(
|
|
103
|
+
const B = (r) => {
|
|
104
|
+
const a = x();
|
|
105
|
+
return /* @__PURE__ */ e(I, { config: a, children: /* @__PURE__ */ e(v, { ...r }) });
|
|
103
106
|
};
|
|
104
|
-
|
|
107
|
+
B.displayName = "FormWizard";
|
|
105
108
|
export {
|
|
106
|
-
|
|
109
|
+
B as default
|
|
107
110
|
};
|
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as n, jsxs as p } from "react/jsx-runtime";
|
|
3
|
-
import { useFormMachine as M } from "../../state-management/machines/useFormMachine.js";
|
|
4
3
|
import { ComponentAlerts as F } from "../../trigger-action-system/components/ComponentAlert/ComponentAlert.js";
|
|
5
4
|
/* empty css */
|
|
6
|
-
import { memo as
|
|
7
|
-
import { adaptComponentForRegistry as
|
|
8
|
-
import { useComponentTriggers as
|
|
9
|
-
import { useComponentVisibility as
|
|
10
|
-
import { useFieldEventHandlers as
|
|
11
|
-
import { useFormContext as
|
|
12
|
-
import { useFormFieldState as
|
|
13
|
-
import { useValidationEvents as
|
|
14
|
-
import { checkHasIsDirtyTriggers as
|
|
5
|
+
import { memo as M, useMemo as N } from "react";
|
|
6
|
+
import { adaptComponentForRegistry as x } from "../ComponentAdapterComplete/ComponentAdapterComplete.js";
|
|
7
|
+
import { useComponentTriggers as _ } from "../hooks/useComponentTriggers.js";
|
|
8
|
+
import { useComponentVisibility as B } from "../hooks/useComponentVisibility.js";
|
|
9
|
+
import { useFieldEventHandlers as H } from "../hooks/useFieldEventHandlers.js";
|
|
10
|
+
import { useFormContext as O } from "../hooks/useFormContext.js";
|
|
11
|
+
import { useFormFieldState as U } from "../hooks/useFormFieldState.js";
|
|
12
|
+
import { useValidationEvents as G } from "../hooks/useValidationEvents.js";
|
|
13
|
+
import { checkHasIsDirtyTriggers as z, shouldBeFormField as P, checkFieldHasValue as j, getValidationDisplayState as q, shouldShowComponentAlerts as J, shouldShowDisplayMode as W } from "../utils/fieldHelpers.js";
|
|
15
14
|
import { logger as e } from "../utils/logger.js";
|
|
16
15
|
import { updateValidationCache as C } from "../utils/validationUX.js";
|
|
17
|
-
import { ProgressLoaderRuntime as
|
|
18
|
-
import { DisplayModeRenderer as
|
|
19
|
-
import { InteractiveFieldRenderer as
|
|
16
|
+
import { ProgressLoaderRuntime as X } from "./ProgressLoaderRuntime.js";
|
|
17
|
+
import { DisplayModeRenderer as Z } from "./renderers/DisplayModeRenderer/DisplayModeRenderer.js";
|
|
18
|
+
import { InteractiveFieldRenderer as K } from "./renderers/InteractiveFieldRenderer/InteractiveFieldRenderer.js";
|
|
19
|
+
import { useFormMachine as Q } from "../../state-management/machines/useFormMachine.js";
|
|
20
20
|
import Y from "../../../../../ui/src/lib/error-boundaries/ComponentErrorBoundary.js";
|
|
21
|
-
const ii =
|
|
21
|
+
const ii = M(
|
|
22
22
|
({ component: i, readOnly: V = !1 }) => {
|
|
23
|
-
const [D, ai, g] =
|
|
23
|
+
const [D, ai, g] = Q(), c = O(), { isVisible: T } = B({
|
|
24
24
|
visibilityConditions: i.visibilityConditions,
|
|
25
25
|
formData: D.context.data
|
|
26
|
-
}), { forceShowValidation: A, resetValidationState: $ } =
|
|
26
|
+
}), { forceShowValidation: A, resetValidationState: $ } = G({
|
|
27
27
|
componentId: i.id
|
|
28
|
-
}), y =
|
|
28
|
+
}), y = z(i), { originalValueFromMachine: b, initializeField: R, getEnhancedIsDirty: S } = U({
|
|
29
29
|
componentId: i.id,
|
|
30
30
|
hasIsDirtyTriggers: y
|
|
31
|
-
}), { handleChange: L, handleBlur: k } =
|
|
31
|
+
}), { handleChange: L, handleBlur: k } = H({
|
|
32
32
|
componentId: i.id,
|
|
33
33
|
hasIsDirtyTriggers: y,
|
|
34
34
|
originalValueFromMachine: b,
|
|
35
35
|
getEnhancedIsDirty: S,
|
|
36
36
|
resetValidationState: $
|
|
37
|
-
}), f =
|
|
37
|
+
}), f = _({
|
|
38
38
|
componentId: i.id
|
|
39
|
-
}), m =
|
|
39
|
+
}), m = N(() => {
|
|
40
40
|
const a = g.validationEngine;
|
|
41
41
|
return e.debug(`ValidationEngine instance check for ${i.id}:`, {
|
|
42
42
|
validationEngine: !!a,
|
|
@@ -156,7 +156,7 @@ const ii = N(
|
|
|
156
156
|
validationRules: i.validation,
|
|
157
157
|
validationEngineExists: !!g.validationEngine
|
|
158
158
|
});
|
|
159
|
-
const w =
|
|
159
|
+
const w = P(i);
|
|
160
160
|
if (i.validation && g.validationEngine)
|
|
161
161
|
try {
|
|
162
162
|
const a = g.validationEngine.validateField(
|
|
@@ -316,21 +316,21 @@ const ii = N(
|
|
|
316
316
|
r
|
|
317
317
|
);
|
|
318
318
|
}
|
|
319
|
-
const s =
|
|
319
|
+
const s = j(t, i.type), d = W(
|
|
320
320
|
V,
|
|
321
321
|
s
|
|
322
|
-
), { isSubmitAttempted: u } =
|
|
322
|
+
), { isSubmitAttempted: u } = q(
|
|
323
323
|
a.state.meta,
|
|
324
324
|
c.state,
|
|
325
325
|
A
|
|
326
|
-
), o =
|
|
326
|
+
), o = J(
|
|
327
327
|
y,
|
|
328
328
|
l,
|
|
329
329
|
f.alerts.length
|
|
330
330
|
);
|
|
331
331
|
return d && I ? /* @__PURE__ */ p("div", { children: [
|
|
332
332
|
/* @__PURE__ */ n(
|
|
333
|
-
|
|
333
|
+
Z,
|
|
334
334
|
{
|
|
335
335
|
component: i,
|
|
336
336
|
fieldValue: t
|
|
@@ -339,7 +339,7 @@ const ii = N(
|
|
|
339
339
|
o && f.alerts.length > 0 && /* @__PURE__ */ n(F, { alerts: f.alerts })
|
|
340
340
|
] }) : /* @__PURE__ */ p("div", { children: [
|
|
341
341
|
/* @__PURE__ */ n(
|
|
342
|
-
|
|
342
|
+
K,
|
|
343
343
|
{
|
|
344
344
|
component: i,
|
|
345
345
|
field: a,
|
|
@@ -369,14 +369,14 @@ const ii = N(
|
|
|
369
369
|
) : i.type === "progress-loader" ? (
|
|
370
370
|
// Special handling for progress-loader: use runtime wrapper for auto-start
|
|
371
371
|
/* @__PURE__ */ n(
|
|
372
|
-
|
|
372
|
+
X,
|
|
373
373
|
{
|
|
374
374
|
properties: i.properties || {}
|
|
375
375
|
}
|
|
376
376
|
)
|
|
377
377
|
) : (
|
|
378
378
|
// For display-only components, render directly without form.Field wrapper
|
|
379
|
-
|
|
379
|
+
x(
|
|
380
380
|
i,
|
|
381
381
|
null,
|
|
382
382
|
// no form value
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
3
3
|
import { clsx as S } from "clsx";
|
|
4
4
|
/* empty css */
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { useFormContext as V } from "../hooks/useFormContext.js";
|
|
6
|
+
import { useFormEditing as y } from "../../../../../ui/src/lib/providers/FormEditingContext.js";
|
|
7
|
+
import { useFormMachine as v } from "../../state-management/machines/useFormMachine.js";
|
|
8
8
|
import { Button as E } from "@rijkshuisstijl-community/components-react";
|
|
9
9
|
const M = ({
|
|
10
10
|
navigation: l,
|
|
@@ -41,7 +41,7 @@ const M = ({
|
|
|
41
41
|
}
|
|
42
42
|
);
|
|
43
43
|
}, A = ({ children: l, ...d }) => {
|
|
44
|
-
const { isEditing: a } =
|
|
44
|
+
const { isEditing: a } = y(), [g, m, n] = v(), { currentStep: r, isLastStep: u } = n, { navigation: b } = r, e = V();
|
|
45
45
|
return /* @__PURE__ */ f(
|
|
46
46
|
M,
|
|
47
47
|
{
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as g, jsxs as h } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { X as P, Edit as w, Check as L } from "lucide-react";
|
|
7
|
-
import { memo as M, useState as R, useMemo as x, useEffect as $, useCallback as S } from "react";
|
|
3
|
+
import { clsx as k } from "clsx";
|
|
4
|
+
import { X as _, Edit as D, Check as P } from "lucide-react";
|
|
5
|
+
import { memo as w, useState as L, useMemo as x, useEffect as M, useCallback as S } from "react";
|
|
8
6
|
import u from "./FormSection.module.css.js";
|
|
9
|
-
import { useFormContext as
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
7
|
+
import { useFormContext as R } from "../../hooks/useFormContext.js";
|
|
8
|
+
import $ from "../FormField.js";
|
|
9
|
+
import { useFormMachine as B } from "../../../state-management/machines/useFormMachine.js";
|
|
10
|
+
import { evaluateVisibility as U } from "../../utils/visibilityUtils.js";
|
|
11
|
+
import { ComponentTriggerEngine as G } from "../../../state-management/machines/componentTriggerEngine.js";
|
|
12
12
|
import { Heading as q, Button as j } from "@rijkshuisstijl-community/components-react";
|
|
13
|
-
const H =
|
|
14
|
-
const [a, d, p] =
|
|
13
|
+
const H = w(({ section: e }) => {
|
|
14
|
+
const [a, d, p] = B(), {
|
|
15
15
|
validateSection: y,
|
|
16
16
|
validateField: C,
|
|
17
17
|
startSectionEdit: T,
|
|
18
18
|
cancelSectionEdit: F
|
|
19
|
-
} = p, m =
|
|
19
|
+
} = p, m = R(), [f, E] = L(!1), N = x(() => {
|
|
20
20
|
if (!e.visibilityConditions)
|
|
21
21
|
return !0;
|
|
22
22
|
const o = a.context.data;
|
|
23
|
-
return
|
|
23
|
+
return U(e.visibilityConditions, o);
|
|
24
24
|
}, [e.visibilityConditions, a.context.data]), r = x(
|
|
25
25
|
() => ({
|
|
26
26
|
title: e.title,
|
|
@@ -44,7 +44,7 @@ const H = M(({ section: e }) => {
|
|
|
44
44
|
() => a.context.activeDialog,
|
|
45
45
|
[a.context.activeDialog]
|
|
46
46
|
);
|
|
47
|
-
|
|
47
|
+
M(() => {
|
|
48
48
|
r.mode !== "editable" || !f || b && !a.context.activeDialog && (console.log(
|
|
49
49
|
"🔥 FormSection: Dialog closed, checking if verification completed"
|
|
50
50
|
), n.every((t) => {
|
|
@@ -148,7 +148,7 @@ const H = M(({ section: e }) => {
|
|
|
148
148
|
}), console.log(
|
|
149
149
|
"🎯 [FormSection] Checking for dirty fields with verification requirements"
|
|
150
150
|
);
|
|
151
|
-
const c = p.config, l = a.context.currentStepIndex, v =
|
|
151
|
+
const c = p.config, l = a.context.currentStepIndex, v = G.createExecutionPlan(
|
|
152
152
|
c,
|
|
153
153
|
"save",
|
|
154
154
|
l,
|
|
@@ -221,7 +221,7 @@ const H = M(({ section: e }) => {
|
|
|
221
221
|
},
|
|
222
222
|
"data-section-id": e.id,
|
|
223
223
|
"data-visible": N,
|
|
224
|
-
children: /* @__PURE__ */ h("div", { className:
|
|
224
|
+
children: /* @__PURE__ */ h("div", { className: k("form-section", u.section), children: [
|
|
225
225
|
r.showTitle && /* @__PURE__ */ h("div", { className: u.sectionHeader, children: [
|
|
226
226
|
/* @__PURE__ */ g(q, { level: 3, children: r.title }),
|
|
227
227
|
r.mode === "editable" && r.showActionLink && /* @__PURE__ */ g("div", { children: f ? /* @__PURE__ */ h(
|
|
@@ -231,7 +231,7 @@ const H = M(({ section: e }) => {
|
|
|
231
231
|
onClick: V,
|
|
232
232
|
className: u.cancelButton,
|
|
233
233
|
children: [
|
|
234
|
-
/* @__PURE__ */ g(
|
|
234
|
+
/* @__PURE__ */ g(_, { className: u.iconSm }),
|
|
235
235
|
r.cancelText
|
|
236
236
|
]
|
|
237
237
|
}
|
|
@@ -242,7 +242,7 @@ const H = M(({ section: e }) => {
|
|
|
242
242
|
onClick: O,
|
|
243
243
|
className: u.editButton,
|
|
244
244
|
children: [
|
|
245
|
-
/* @__PURE__ */ g(
|
|
245
|
+
/* @__PURE__ */ g(D, { className: u.iconSm }),
|
|
246
246
|
r.editText
|
|
247
247
|
]
|
|
248
248
|
}
|
|
@@ -250,7 +250,7 @@ const H = M(({ section: e }) => {
|
|
|
250
250
|
] }),
|
|
251
251
|
/* @__PURE__ */ h("div", { className: u.sectionContent, children: [
|
|
252
252
|
r.components.map((o) => /* @__PURE__ */ g(
|
|
253
|
-
|
|
253
|
+
$,
|
|
254
254
|
{
|
|
255
255
|
component: o,
|
|
256
256
|
readOnly: I
|
|
@@ -263,7 +263,7 @@ const H = M(({ section: e }) => {
|
|
|
263
263
|
appearance: "primary-action-button",
|
|
264
264
|
onClick: A,
|
|
265
265
|
children: [
|
|
266
|
-
/* @__PURE__ */ g(
|
|
266
|
+
/* @__PURE__ */ g(P, { className: u.iconSm }),
|
|
267
267
|
r.saveText
|
|
268
268
|
]
|
|
269
269
|
}
|
|
@@ -4,28 +4,28 @@ import h from "./FormStep.module.css.js";
|
|
|
4
4
|
/* empty css */
|
|
5
5
|
import { isTemplateStep as m } from "../../../../../../ui/src/lib/types/guards.js";
|
|
6
6
|
import { logger as U } from "../../../../../../ui/src/lib/logger.js";
|
|
7
|
-
import {
|
|
8
|
-
import { useFormMachine as k } from "../../../state-management/machines/useFormMachine.js";
|
|
9
|
-
import { useForm as W } from "@tanstack/react-form";
|
|
7
|
+
import { useForm as C } from "@tanstack/react-form";
|
|
10
8
|
import { useRef as p } from "react";
|
|
11
|
-
import { LoaderProvider as
|
|
12
|
-
import { FormProvider as
|
|
9
|
+
import { LoaderProvider as k, useLoaderContext as W } from "../../context/LoaderContext.js";
|
|
10
|
+
import { FormProvider as G } from "../../hooks/useFormContext.js";
|
|
13
11
|
import { buildDefaultValues as E } from "../../utils/formDataBuilder.js";
|
|
14
|
-
import { resetFormDirtyStateAfterApiPopulation as
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import { ProgressLoaderRuntime as
|
|
12
|
+
import { resetFormDirtyStateAfterApiPopulation as H } from "../../utils/formDirtyStateSync.js";
|
|
13
|
+
import j from "../FormFooter.js";
|
|
14
|
+
import z from "../FormHeader.js";
|
|
15
|
+
import q from "../FormSection/FormSection.js";
|
|
16
|
+
import { ProgressLoaderRuntime as K } from "../ProgressLoaderRuntime.js";
|
|
17
|
+
import { useFormMachine as Q } from "../../../state-management/machines/useFormMachine.js";
|
|
18
|
+
import { EnhancedActionExecutor as X } from "../../../api-integration/components/EnhancedActionExecutor/EnhancedActionExecutor.js";
|
|
19
19
|
import { ValidationEngine as B } from "../../../validation-system/validation/ValidationEngine.js";
|
|
20
20
|
const J = ({
|
|
21
21
|
currentStep: s,
|
|
22
22
|
hasStepLoader: a,
|
|
23
23
|
loaderConfig: o
|
|
24
24
|
}) => {
|
|
25
|
-
const { isLoadingComplete: t } =
|
|
25
|
+
const { isLoadingComplete: t } = W(), d = m(s) ? [] : s.sections || [];
|
|
26
26
|
return /* @__PURE__ */ f("div", { className: h.stepContent, children: [
|
|
27
27
|
a && /* @__PURE__ */ i("div", { className: h.loaderWrapper, children: /* @__PURE__ */ i(
|
|
28
|
-
|
|
28
|
+
K,
|
|
29
29
|
{
|
|
30
30
|
properties: {
|
|
31
31
|
label: o?.label,
|
|
@@ -46,10 +46,10 @@ const J = ({
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
) }),
|
|
49
|
-
(!a || t) && /* @__PURE__ */ i(M, { children: d.map((c) => /* @__PURE__ */ i(
|
|
49
|
+
(!a || t) && /* @__PURE__ */ i(M, { children: d.map((c) => /* @__PURE__ */ i(q, { section: c }, c.id)) })
|
|
50
50
|
] });
|
|
51
51
|
}, Y = () => {
|
|
52
|
-
const [s, a, o] =
|
|
52
|
+
const [s, a, o] = Q(), { currentStep: t, config: d } = o, c = p(), u = p(), F = p(), b = d.validationMessageStyle || "withLabel";
|
|
53
53
|
c.current || (c.current = new B({ messageStyle: b })), (!u.current || F.current !== t.id) && (m(t) ? u.current = c.current.getStepSchema({
|
|
54
54
|
...t,
|
|
55
55
|
sections: []
|
|
@@ -95,7 +95,7 @@ const J = ({
|
|
|
95
95
|
e.targetStep && o.goToStep(e.targetStep);
|
|
96
96
|
break;
|
|
97
97
|
}
|
|
98
|
-
}, l =
|
|
98
|
+
}, l = C({
|
|
99
99
|
defaultValues: v,
|
|
100
100
|
onSubmit: N
|
|
101
101
|
}), w = (e, n) => {
|
|
@@ -106,7 +106,7 @@ const J = ({
|
|
|
106
106
|
const I = n;
|
|
107
107
|
o.setData(r, I), l.setFieldValue(r, n);
|
|
108
108
|
try {
|
|
109
|
-
|
|
109
|
+
H(l, {
|
|
110
110
|
updatedFields: [r],
|
|
111
111
|
debug: process.env.NODE_ENV === "development"
|
|
112
112
|
}), console.log("✅ Dirty state reset complete for:", r);
|
|
@@ -122,9 +122,9 @@ const J = ({
|
|
|
122
122
|
});
|
|
123
123
|
}, 0));
|
|
124
124
|
}, A = t, T = !m(t) && A.waitForLoader === !0, _ = T ? A.loaderConfig : void 0;
|
|
125
|
-
return /* @__PURE__ */ f(
|
|
125
|
+
return /* @__PURE__ */ f(G, { value: l, children: [
|
|
126
126
|
s.matches("executingActions") && (s.context.executingTrigger === "onStepLoad" || s.context.executingTrigger === "onStepFinish") && /* @__PURE__ */ i(
|
|
127
|
-
|
|
127
|
+
X,
|
|
128
128
|
{
|
|
129
129
|
actions: t.actions || [],
|
|
130
130
|
trigger: s.context.executingTrigger || "onStepLoad",
|
|
@@ -146,8 +146,8 @@ const J = ({
|
|
|
146
146
|
e.preventDefault(), e.stopPropagation(), l.handleSubmit();
|
|
147
147
|
},
|
|
148
148
|
children: [
|
|
149
|
-
/* @__PURE__ */ i(
|
|
150
|
-
/* @__PURE__ */ i(
|
|
149
|
+
/* @__PURE__ */ i(z, {}),
|
|
150
|
+
/* @__PURE__ */ i(k, { children: /* @__PURE__ */ i(
|
|
151
151
|
J,
|
|
152
152
|
{
|
|
153
153
|
currentStep: t,
|
|
@@ -155,7 +155,7 @@ const J = ({
|
|
|
155
155
|
loaderConfig: _
|
|
156
156
|
}
|
|
157
157
|
) }),
|
|
158
|
-
/* @__PURE__ */ i(
|
|
158
|
+
/* @__PURE__ */ i(j, { className: h.footer })
|
|
159
159
|
]
|
|
160
160
|
}
|
|
161
161
|
)
|
package/wizard/src/features/form-runtime/components/StepProgressIndicator/StepProgressIndicator.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as r, jsx as t } from "react/jsx-runtime";
|
|
3
3
|
/* empty css */
|
|
4
|
-
import { useFormMachine as h } from "../../../state-management/machines/useFormMachine.js";
|
|
5
4
|
import o from "clsx";
|
|
6
5
|
import e from "./StepProgressIndicator.module.css.js";
|
|
6
|
+
import { useFormMachine as h } from "../../../state-management/machines/useFormMachine.js";
|
|
7
7
|
import v from "../../../../../../ui/src/lib/assets/icons/Check.js";
|
|
8
8
|
import N from "../../../../../../ui/src/lib/assets/icons/ChevronRight.js";
|
|
9
9
|
import { Heading as f } from "@rijkshuisstijl-community/components-react";
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { resolveTemplateStep as i } from "./templateLoader.js";
|
|
3
|
-
import { isTemplateStep as
|
|
3
|
+
import { isTemplateStep as n } from "../../../../../core/src/types/guards.js";
|
|
4
4
|
async function m(e) {
|
|
5
|
-
const
|
|
5
|
+
const s = {
|
|
6
6
|
next: { label: "Next", enabled: !0 },
|
|
7
7
|
previous: { label: "Previous", enabled: !0 }
|
|
8
8
|
}, l = await Promise.all(
|
|
9
|
-
e.steps.map(async (
|
|
10
|
-
if (
|
|
11
|
-
const a = { ...
|
|
12
|
-
|
|
13
|
-
const o =
|
|
9
|
+
e.steps.map(async (t, r) => {
|
|
10
|
+
if (n(t)) {
|
|
11
|
+
const a = { ...s };
|
|
12
|
+
r === 0 && (a.previous.enabled = !1), r === e.steps.length - 1 && (a.next.label = "Submit");
|
|
13
|
+
const o = t.stepIndex;
|
|
14
14
|
return await i(
|
|
15
|
-
|
|
15
|
+
t,
|
|
16
16
|
a,
|
|
17
17
|
o
|
|
18
18
|
);
|
|
19
19
|
}
|
|
20
|
-
return
|
|
20
|
+
return t;
|
|
21
21
|
})
|
|
22
22
|
);
|
|
23
23
|
return {
|
|
@@ -26,13 +26,9 @@ async function m(e) {
|
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
function f(e) {
|
|
29
|
-
return e.steps.some((
|
|
30
|
-
}
|
|
31
|
-
function d(e) {
|
|
32
|
-
return e.steps.filter(r).map((t) => t.templateId);
|
|
29
|
+
return e.steps.some((s) => n(s));
|
|
33
30
|
}
|
|
34
31
|
export {
|
|
35
|
-
d as getUsedTemplateIds,
|
|
36
32
|
f as hasTemplateSteps,
|
|
37
33
|
m as resolveFormWizardConfig
|
|
38
34
|
};
|