df-ae-forms-package 1.0.68 → 1.0.70
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/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.esm.js +14 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +14 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -5997,6 +5997,16 @@ onComponentSelect, onComponentDelete, onComponentEdit, onComponentUpdate, select
|
|
|
5997
5997
|
values[component.id] = '';
|
|
5998
5998
|
}
|
|
5999
5999
|
}
|
|
6000
|
+
// CRITICAL: Also store by label and _id so conditional logic can find values.
|
|
6001
|
+
// condition.when stores the component LABEL (set in ConditionalLogicComponent.tsx line 163).
|
|
6002
|
+
// getComponentValue() checks formValues[label] first, so we must populate it here
|
|
6003
|
+
// to ensure show/hide logic evaluates correctly on initial load (before any user interaction).
|
|
6004
|
+
if (component.basic?.label) {
|
|
6005
|
+
values[component.basic.label] = values[component.id];
|
|
6006
|
+
}
|
|
6007
|
+
if (component._id) {
|
|
6008
|
+
values[component._id] = values[component.id];
|
|
6009
|
+
}
|
|
6000
6010
|
}
|
|
6001
6011
|
// Handle nested components in table cells
|
|
6002
6012
|
if (component.cells && Array.isArray(component.cells)) {
|
|
@@ -6169,8 +6179,10 @@ onComponentSelect, onComponentDelete, onComponentEdit, onComponentUpdate, select
|
|
|
6169
6179
|
// Initialize notes and attachments state
|
|
6170
6180
|
setComponentNotes(prev => ({ ...initialNotes, ...prev }));
|
|
6171
6181
|
setComponentAttachments(prev => ({ ...initialAttachments, ...prev }));
|
|
6172
|
-
// Evaluate initial conditional logic
|
|
6173
|
-
|
|
6182
|
+
// Evaluate initial conditional logic with the freshly computed initialValues.
|
|
6183
|
+
// We pass initialValues explicitly because setFormValues is async and formValues
|
|
6184
|
+
// in the closure is still the old state at this point.
|
|
6185
|
+
evaluateConditionalLogic(initialValues, validatedFormComponents);
|
|
6174
6186
|
}, [initialFormData, formComponents]);
|
|
6175
6187
|
// Synchronize component visibility whenever form values or components change
|
|
6176
6188
|
useEffect(() => {
|
|
@@ -6393,8 +6405,6 @@ onComponentSelect, onComponentDelete, onComponentEdit, onComponentUpdate, select
|
|
|
6393
6405
|
validateField(change.id);
|
|
6394
6406
|
}, 150);
|
|
6395
6407
|
}
|
|
6396
|
-
// Re-evaluate immediately to ensure responsive UI
|
|
6397
|
-
evaluateConditionalLogic(newFormValues, updatedComponents);
|
|
6398
6408
|
}, [formComponents, formValues, validationErrors, onFormDataChange, evaluateConditionalLogic]);
|
|
6399
6409
|
// Recursive function to find a component by ID in nested structures
|
|
6400
6410
|
const findComponentById = useCallback((components, fieldId) => {
|