df-ae-forms-package 1.1.3 → 1.1.4
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.esm.js +38 -18
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +38 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1002,20 +1002,15 @@ const DfFormInput = ({ id, properties, validationErrors = {}, formValue = '', in
|
|
|
1002
1002
|
touchedFields[id] = true;
|
|
1003
1003
|
}
|
|
1004
1004
|
}, [isTouched, id, touchedFields]);
|
|
1005
|
-
// Reset touched state
|
|
1005
|
+
// Reset touched state when switching modes
|
|
1006
1006
|
useEffect(() => {
|
|
1007
|
+
setIsTouched(false);
|
|
1008
|
+
// Only reset value when explicitly moving to edit mode to show current default
|
|
1007
1009
|
if (mode === 'edit') {
|
|
1008
|
-
setIsTouched(false);
|
|
1009
|
-
// Reset value to default value when switching to edit mode
|
|
1010
1010
|
const defaultValue = properties?.basic?.defaultValue || '';
|
|
1011
1011
|
setValue(defaultValue);
|
|
1012
1012
|
}
|
|
1013
|
-
|
|
1014
|
-
setIsTouched(false);
|
|
1015
|
-
// Reset value to empty when switching to test mode for fresh start
|
|
1016
|
-
setValue('');
|
|
1017
|
-
}
|
|
1018
|
-
}, [mode, properties?.basic?.defaultValue]);
|
|
1013
|
+
}, [mode]);
|
|
1019
1014
|
// Update value when formValue prop changes (but don't override user input)
|
|
1020
1015
|
// CRITICAL: Only update if formValue is actually for THIS component's ID
|
|
1021
1016
|
// Use componentIdRef to ensure we're checking against the correct component ID
|
|
@@ -4965,8 +4960,7 @@ const DfFormDataGrid = ({ id, properties, mode = 'edit', formData = {}, onValueC
|
|
|
4965
4960
|
// This allows the form data to be updated for interactive components
|
|
4966
4961
|
if (onValueChange) {
|
|
4967
4962
|
onValueChange({
|
|
4968
|
-
|
|
4969
|
-
value: change.value
|
|
4963
|
+
...change
|
|
4970
4964
|
});
|
|
4971
4965
|
}
|
|
4972
4966
|
}
|
|
@@ -5682,9 +5676,35 @@ onComponentSelect, onComponentDelete, onComponentEdit, onComponentUpdate, select
|
|
|
5682
5676
|
return;
|
|
5683
5677
|
}
|
|
5684
5678
|
// CRITICAL: Check if multiple components share this ID (ID collision detection)
|
|
5685
|
-
|
|
5679
|
+
// Use recursive search for accurate detection across all levels
|
|
5680
|
+
const checkIdCollision = (components, targetId) => {
|
|
5681
|
+
let matches = [];
|
|
5682
|
+
components.forEach(comp => {
|
|
5683
|
+
if (ensureStringId$1(comp.id) === targetId)
|
|
5684
|
+
matches.push(comp);
|
|
5685
|
+
if (comp.name === 'section' && comp.children) {
|
|
5686
|
+
matches = [...matches, ...checkIdCollision(comp.children, targetId)];
|
|
5687
|
+
}
|
|
5688
|
+
if (comp.name === 'table' && comp.cells) {
|
|
5689
|
+
comp.cells.forEach((row) => {
|
|
5690
|
+
normalizeTableRow(row).forEach((cell) => {
|
|
5691
|
+
if (cell.components)
|
|
5692
|
+
matches = [...matches, ...checkIdCollision(cell.components, targetId)];
|
|
5693
|
+
});
|
|
5694
|
+
});
|
|
5695
|
+
}
|
|
5696
|
+
if (comp.name === 'datagrid' && comp.entries) {
|
|
5697
|
+
comp.entries.forEach((entry) => {
|
|
5698
|
+
if (entry.components)
|
|
5699
|
+
matches = [...matches, ...checkIdCollision(entry.components, targetId)];
|
|
5700
|
+
});
|
|
5701
|
+
}
|
|
5702
|
+
});
|
|
5703
|
+
return matches;
|
|
5704
|
+
};
|
|
5705
|
+
const componentsWithSameId = checkIdCollision(localFormComponents, change.id);
|
|
5686
5706
|
if (componentsWithSameId.length > 1) {
|
|
5687
|
-
console.error(`[DfFormPreview] ID COLLISION DETECTED! Multiple components share ID "${change.id}":`, componentsWithSameId.map(c => ({ id: c.id, name: c.name, label: c.basic?.label })));
|
|
5707
|
+
console.error(`[DfFormPreview] ID COLLISION DETECTED! Multiple components share ID "${change.id}":`, componentsWithSameId.map(c => ({ id: ensureStringId$1(c.id), name: c.name, label: c.basic?.label })));
|
|
5688
5708
|
// Don't update - this would cause all components with this ID to get the same value
|
|
5689
5709
|
return;
|
|
5690
5710
|
}
|
|
@@ -5703,7 +5723,7 @@ onComponentSelect, onComponentDelete, onComponentEdit, onComponentUpdate, select
|
|
|
5703
5723
|
}
|
|
5704
5724
|
// Clear raised issues for this component when value changes
|
|
5705
5725
|
// This ensures that if threshold condition changes, user must raise issue again
|
|
5706
|
-
const component = localFormComponents
|
|
5726
|
+
const component = findComponentById(localFormComponents, change.id);
|
|
5707
5727
|
if (component) {
|
|
5708
5728
|
const threshold = component?.threshold;
|
|
5709
5729
|
if (threshold && threshold.conditions && threshold.conditions.length > 0) {
|
|
@@ -5719,7 +5739,8 @@ onComponentSelect, onComponentDelete, onComponentEdit, onComponentUpdate, select
|
|
|
5719
5739
|
// Recursive function to update component values
|
|
5720
5740
|
const updateComponentValue = (components) => {
|
|
5721
5741
|
return components.map(component => {
|
|
5722
|
-
|
|
5742
|
+
const componentId = ensureStringId$1(component.id);
|
|
5743
|
+
if (componentId === change.id) {
|
|
5723
5744
|
// CRITICAL: Handle table/datagrid structure updates (cells, entries, etc.)
|
|
5724
5745
|
// When a table sends onValueChange with cells data, update the whole component structure
|
|
5725
5746
|
if (change.value && typeof change.value === 'object' && 'cells' in change.value) {
|
|
@@ -5735,13 +5756,12 @@ onComponentSelect, onComponentDelete, onComponentEdit, onComponentUpdate, select
|
|
|
5735
5756
|
...change.value
|
|
5736
5757
|
};
|
|
5737
5758
|
}
|
|
5738
|
-
if ('defaultValue' in component.basic) {
|
|
5759
|
+
if ('value' in component.basic || 'defaultValue' in component.basic) {
|
|
5739
5760
|
return {
|
|
5740
5761
|
...component,
|
|
5741
5762
|
basic: {
|
|
5742
5763
|
...component.basic,
|
|
5743
|
-
value: change.value
|
|
5744
|
-
defaultValue: change.value
|
|
5764
|
+
value: change.value
|
|
5745
5765
|
}
|
|
5746
5766
|
};
|
|
5747
5767
|
}
|