@digiform/wizard 0.3.1 โ 0.3.3
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/features/form-runtime/components/FormFooter.d.ts +5 -0
- package/features/form-runtime/hooks/useValidationEvents.d.ts +0 -1
- package/features/form-runtime/index.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 +24 -6
- package/package.json +31 -15
- package/styles.css +1 -1
- package/ui/src/lib/types/guards.js +1 -5
- 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 +48 -95
- package/wizard/src/features/form-runtime/FormWizard/FormWizard.module.css.js +4 -12
- package/wizard/src/features/form-runtime/components/FormFooter.js +53 -184
- package/wizard/src/features/form-runtime/components/FormSection/FormSection.js +150 -194
- package/wizard/src/features/form-runtime/components/FormStep/FormStep.js +92 -108
- package/wizard/src/features/form-runtime/components/StepProgressIndicator/StepProgressIndicator.js +24 -30
- package/wizard/src/features/form-runtime/hooks/useComponentTriggers.js +44 -63
- package/wizard/src/features/form-runtime/hooks/useFieldEventHandlers.js +26 -40
- package/wizard/src/features/form-runtime/hooks/useValidationEvents.js +22 -25
- 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/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 +173 -191
- 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/ValidationExecutor.js +47 -87
- package/core/src/types/guards.js +0 -7
- package/features/form-runtime/config/configResolver.d.ts +0 -14
- package/features/form-runtime/config/index.d.ts +0 -9
- package/features/form-runtime/config/templateConfig.d.ts +0 -148
- package/features/form-runtime/config/templateLoader.d.ts +0 -25
- package/features/form-runtime/config/templateUtils.d.ts +0 -12
- package/features/form-runtime/utils/formSaver.d.ts +0 -22
- 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/trigger-action-system/components/FieldWarning/FieldWarning.d.ts +0 -20
- package/ui/src/lib/utils/templateUtils.js +0 -20
- package/wizard/src/features/form-runtime/config/configResolver.js +0 -34
- package/wizard/src/features/form-runtime/config/templateLoader.js +0 -235
|
@@ -1,50 +1,39 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
function n(
|
|
3
|
-
const
|
|
4
|
-
r && console.log("๐ [formDirtyStateSync] Starting dirty state reset:", {
|
|
5
|
-
updatedFields: a,
|
|
6
|
-
formState: {
|
|
7
|
-
isDirty: t.state.isDirty,
|
|
8
|
-
dirtyFields: t.state.dirtyFields,
|
|
9
|
-
values: t.state.values
|
|
10
|
-
}
|
|
11
|
-
});
|
|
2
|
+
function n(a, u = {}) {
|
|
3
|
+
const e = a, { updatedFields: c, debug: o = !1 } = u;
|
|
12
4
|
try {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
if (
|
|
17
|
-
currentValue:
|
|
18
|
-
isDirtyBefore:
|
|
19
|
-
isTouchedBefore:
|
|
20
|
-
isDefaultValueBefore:
|
|
21
|
-
}),
|
|
5
|
+
const s = Object.keys(e.state.values);
|
|
6
|
+
(c || s).forEach((t) => {
|
|
7
|
+
const r = e.getFieldValue(t), i = e.getFieldMeta(t);
|
|
8
|
+
if (o && console.log(`[formDirtyStateSync] Field ${t} before reset:`, {
|
|
9
|
+
currentValue: r,
|
|
10
|
+
isDirtyBefore: i?.isDirty,
|
|
11
|
+
isTouchedBefore: i?.isTouched,
|
|
12
|
+
isDefaultValueBefore: i?.isDefaultValue
|
|
13
|
+
}), e.resetField(t), r != null && r !== "" && e.setFieldValue(t, r, {
|
|
22
14
|
dontUpdateMeta: !0
|
|
23
15
|
// This prevents updating isDirty/isTouched flags
|
|
24
|
-
}),
|
|
25
|
-
const l =
|
|
26
|
-
console.log(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
currentValueAfter: t.getFieldValue(e)
|
|
33
|
-
}
|
|
34
|
-
);
|
|
16
|
+
}), o) {
|
|
17
|
+
const l = e.getFieldMeta(t);
|
|
18
|
+
console.log(`[formDirtyStateSync] Field ${t} reset complete:`, {
|
|
19
|
+
isDirtyAfter: l?.isDirty,
|
|
20
|
+
isTouchedAfter: l?.isTouched,
|
|
21
|
+
isDefaultValueAfter: l?.isDefaultValue,
|
|
22
|
+
currentValueAfter: e.getFieldValue(t)
|
|
23
|
+
});
|
|
35
24
|
}
|
|
36
|
-
}),
|
|
25
|
+
}), o && console.log("[formDirtyStateSync] Reset complete:", {
|
|
37
26
|
formStateAfter: {
|
|
38
|
-
isDirty:
|
|
39
|
-
dirtyFields:
|
|
40
|
-
values:
|
|
27
|
+
isDirty: e.state.isDirty,
|
|
28
|
+
dirtyFields: e.state.dirtyFields,
|
|
29
|
+
values: e.state.values
|
|
41
30
|
}
|
|
42
31
|
});
|
|
43
|
-
} catch (
|
|
32
|
+
} catch (s) {
|
|
44
33
|
throw console.error(
|
|
45
34
|
"โ [formDirtyStateSync] Error during dirty state reset:",
|
|
46
|
-
|
|
47
|
-
),
|
|
35
|
+
s
|
|
36
|
+
), s;
|
|
48
37
|
}
|
|
49
38
|
}
|
|
50
39
|
export {
|
|
@@ -39,13 +39,13 @@ class n {
|
|
|
39
39
|
* Debug level logging
|
|
40
40
|
*/
|
|
41
41
|
debug(e, o) {
|
|
42
|
-
this.config.enabled && console.log(
|
|
42
|
+
this.config.enabled && console.log(`[FormField] ${e}`, ...o !== void 0 ? [o] : []);
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
45
|
* Info level logging
|
|
46
46
|
*/
|
|
47
47
|
info(e, o) {
|
|
48
|
-
this.config.enabled && console.log(
|
|
48
|
+
this.config.enabled && console.log(`[FormField] ${e}`, ...o !== void 0 ? [o] : []);
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
51
|
* Warning level logging
|
|
@@ -69,43 +69,43 @@ class n {
|
|
|
69
69
|
* Validation specific logging
|
|
70
70
|
*/
|
|
71
71
|
validation(e, o) {
|
|
72
|
-
this.config.enabled && console.log(
|
|
72
|
+
this.config.enabled && console.log(`[FormField:validation] ${e}`, ...o !== void 0 ? [o] : []);
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* State management specific logging
|
|
76
76
|
*/
|
|
77
77
|
state(e, o) {
|
|
78
|
-
this.config.enabled && console.log(
|
|
78
|
+
this.config.enabled && console.log(`[FormField:state] ${e}`, ...o !== void 0 ? [o] : []);
|
|
79
79
|
}
|
|
80
80
|
/**
|
|
81
81
|
* Component lifecycle logging
|
|
82
82
|
*/
|
|
83
83
|
lifecycle(e, o) {
|
|
84
|
-
this.config.enabled && console.log(
|
|
84
|
+
this.config.enabled && console.log(`[FormField:lifecycle] ${e}`, ...o !== void 0 ? [o] : []);
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
87
|
* Change event logging
|
|
88
88
|
*/
|
|
89
89
|
change(e, o) {
|
|
90
|
-
this.config.enabled && console.log(
|
|
90
|
+
this.config.enabled && console.log(`[FormField:change] ${e}`, ...o !== void 0 ? [o] : []);
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
93
93
|
* Test/experimental logging
|
|
94
94
|
*/
|
|
95
95
|
test(e, o) {
|
|
96
|
-
this.config.enabled && console.log(
|
|
96
|
+
this.config.enabled && console.log(`[FormField:test] ${e}`, ...o !== void 0 ? [o] : []);
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
-
const i = new n(), l = () => i.setEnabled(!0),
|
|
99
|
+
const i = new n(), l = () => i.setEnabled(!0), d = () => i.setEnabled(!1), t = () => i.isEnabled();
|
|
100
100
|
typeof window < "u" && (window.formFieldLogger = {
|
|
101
101
|
enable: l,
|
|
102
|
-
disable:
|
|
103
|
-
isEnabled:
|
|
102
|
+
disable: d,
|
|
103
|
+
isEnabled: t,
|
|
104
104
|
logger: i
|
|
105
105
|
});
|
|
106
106
|
export {
|
|
107
|
-
|
|
107
|
+
d as disableFormFieldLogging,
|
|
108
108
|
l as enableFormFieldLogging,
|
|
109
|
-
|
|
109
|
+
t as isFormFieldLoggingEnabled,
|
|
110
110
|
i as logger
|
|
111
111
|
};
|
|
@@ -12,7 +12,8 @@ t({
|
|
|
12
12
|
);
|
|
13
13
|
return e.config.steps[n]?.id || "";
|
|
14
14
|
},
|
|
15
|
-
pendingNavigation: null
|
|
15
|
+
pendingNavigation: null,
|
|
16
|
+
forcedValidationFields: []
|
|
16
17
|
});
|
|
17
18
|
t({
|
|
18
19
|
currentStepIndex: ({ context: e }) => Math.max(e.currentStepIndex - 1, 0),
|
|
@@ -20,18 +21,20 @@ t({
|
|
|
20
21
|
const n = Math.max(e.currentStepIndex - 1, 0);
|
|
21
22
|
return e.config.steps[n]?.id || "";
|
|
22
23
|
},
|
|
23
|
-
pendingNavigation: null
|
|
24
|
+
pendingNavigation: null,
|
|
25
|
+
forcedValidationFields: []
|
|
24
26
|
});
|
|
25
27
|
t({
|
|
26
28
|
currentStepIndex: ({ context: e, event: n }) => {
|
|
27
29
|
if (n.type !== "GO_TO_STEP") return e.currentStepIndex;
|
|
28
30
|
const i = e.config.steps.findIndex(
|
|
29
|
-
(
|
|
31
|
+
(a) => a.id === n.stepId
|
|
30
32
|
);
|
|
31
33
|
return i >= 0 ? i : e.currentStepIndex;
|
|
32
34
|
},
|
|
33
35
|
currentStepId: ({ context: e, event: n }) => n.type !== "GO_TO_STEP" ? e.currentStepId : n.stepId,
|
|
34
|
-
pendingNavigation: null
|
|
36
|
+
pendingNavigation: null,
|
|
37
|
+
forcedValidationFields: []
|
|
35
38
|
});
|
|
36
39
|
t({
|
|
37
40
|
currentStepIndex: ({ context: e }) => {
|
|
@@ -42,7 +45,8 @@ t({
|
|
|
42
45
|
},
|
|
43
46
|
currentStepId: ({ context: e }) => e.pendingNavigation?.stepId || e.currentStepId,
|
|
44
47
|
pendingNavigation: null,
|
|
45
|
-
canNavigate: !0
|
|
48
|
+
canNavigate: !0,
|
|
49
|
+
forcedValidationFields: []
|
|
46
50
|
});
|
|
47
51
|
t({
|
|
48
52
|
pendingNavigation: { type: "next" }
|
|
@@ -95,9 +99,10 @@ t({
|
|
|
95
99
|
activeWarnings: [],
|
|
96
100
|
pendingVerifications: [],
|
|
97
101
|
verificationResults: {}
|
|
98
|
-
}
|
|
102
|
+
},
|
|
103
|
+
forcedValidationFields: []
|
|
99
104
|
});
|
|
100
|
-
const
|
|
105
|
+
const d = ({
|
|
101
106
|
context: e,
|
|
102
107
|
self: n
|
|
103
108
|
}) => {
|
|
@@ -118,5 +123,5 @@ const p = ({
|
|
|
118
123
|
}
|
|
119
124
|
};
|
|
120
125
|
export {
|
|
121
|
-
|
|
126
|
+
d as executePendingNavigation
|
|
122
127
|
};
|