@rsuci/shared-form-components 1.0.40 → 1.0.41
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/form-renderer/FormRenderer.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAyC,MAAM,OAAO,CAAC;AAC9D,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,cAAc,EAIf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EAEtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAmBlF;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,6BAA6B;IAC7B,UAAU,EAAE,iBAAiB,CAAC;IAC9B,6DAA6D;IAC7D,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,yBAAyB;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAClD,oCAAoC;IACpC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,iCAAiC;IACjC,SAAS,EAAE,qBAAqB,CAAC;IACjC,wBAAwB;IACxB,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC,wCAAwC;IACxC,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,iCAAiC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iCAAiC;IACjC,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;
|
|
1
|
+
{"version":3,"file":"FormRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/form-renderer/FormRenderer.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAyC,MAAM,OAAO,CAAC;AAC9D,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,cAAc,EAIf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EAEtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAmBlF;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,6BAA6B;IAC7B,UAAU,EAAE,iBAAiB,CAAC;IAC9B,6DAA6D;IAC7D,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,yBAAyB;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAClD,oCAAoC;IACpC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,iCAAiC;IACjC,SAAS,EAAE,qBAAqB,CAAC;IACjC,wBAAwB;IACxB,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC,wCAAwC;IACxC,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,iCAAiC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iCAAiC;IACjC,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AA6fD;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAgBpD,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -98,7 +98,36 @@ const FormRendererInner = () => {
|
|
|
98
98
|
};
|
|
99
99
|
// Navigation - Validation avant navigation
|
|
100
100
|
const groupes = groupesWithInstances.length > 0 ? groupesWithInstances : formulaire?.groupes || [];
|
|
101
|
-
|
|
101
|
+
// Validation locale utilisant isVariableVisible du formTree
|
|
102
|
+
const validateCurrentGroupWithVisibility = useCallback(() => {
|
|
103
|
+
if (!currentGroup || !currentGroup.variables)
|
|
104
|
+
return true;
|
|
105
|
+
// Pour les groupes multiples, vérifier si toutes les instances sont complètes
|
|
106
|
+
if (currentGroup.estMultiple && currentGroup.instances) {
|
|
107
|
+
return validation.validateAllInstancesComplete(currentGroup);
|
|
108
|
+
}
|
|
109
|
+
// Pour les groupes normaux, valider uniquement les variables visibles et obligatoires
|
|
110
|
+
const requiredVariables = currentGroup.variables.filter(v => v.estObligatoire);
|
|
111
|
+
for (const variable of requiredVariables) {
|
|
112
|
+
// Vérifier si la variable est visible via le formTree
|
|
113
|
+
const isVisible = isVariableVisible(variable);
|
|
114
|
+
if (!isVisible) {
|
|
115
|
+
// Variable masquée = pas de validation
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
// Vérifier si la variable a une valeur
|
|
119
|
+
const responseKey = currentGroup.estMultiple && currentInstance?.numeroInstance
|
|
120
|
+
? `${variable.code}_${currentInstance.numeroInstance}`
|
|
121
|
+
: variable.code;
|
|
122
|
+
const response = responses[responseKey];
|
|
123
|
+
const hasValue = response && response.valeur != null && response.valeur !== '';
|
|
124
|
+
if (!hasValue) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return true;
|
|
129
|
+
}, [currentGroup, currentInstance, responses, isVariableVisible, validation]);
|
|
130
|
+
const canGoNext = validateCurrentGroupWithVisibility();
|
|
102
131
|
const isFormValid = validation.validateAllGroups(groupes, responses).isValid;
|
|
103
132
|
const handleNext = () => {
|
|
104
133
|
if (canGoNext && !navigation.isLastGroup) {
|
package/package.json
CHANGED