@rsuci/shared-form-components 1.0.6 → 1.0.7
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":"GeographicCascadeInput.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/GeographicCascadeInput.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAA2C,MAAM,OAAO,CAAC;AAUhE;;GAEG;AACH,UAAU,SAAS;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAWD,UAAU,2BAA2B;IACnC,QAAQ,EAAE,GAAG,CAAC;IACd,KAAK,EAAE,GAAG,CAAC;IACX,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,KAAK,IAAI,CAAC;IAC5C,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,
|
|
1
|
+
{"version":3,"file":"GeographicCascadeInput.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/GeographicCascadeInput.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAA2C,MAAM,OAAO,CAAC;AAUhE;;GAEG;AACH,UAAU,SAAS;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAWD,UAAU,2BAA2B;IACnC,QAAQ,EAAE,GAAG,CAAC;IACd,KAAK,EAAE,GAAG,CAAC;IACX,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,KAAK,IAAI,CAAC;IAC5C,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAgMxE,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -47,10 +47,25 @@ export const GeographicCascadeInput = ({ variable, value, onChange, reponses, di
|
|
|
47
47
|
}
|
|
48
48
|
const result = await response.json();
|
|
49
49
|
// Vérifier le format de la réponse
|
|
50
|
-
|
|
50
|
+
// Support pour plusieurs formats possibles
|
|
51
|
+
if (Array.isArray(result)) {
|
|
52
|
+
// Format 1: tableau direct [...]
|
|
53
|
+
setItems(result);
|
|
54
|
+
}
|
|
55
|
+
else if (result.status === 'SUCCESS' && Array.isArray(result.data)) {
|
|
56
|
+
// Format 2: { status: "SUCCESS", data: [...] } (format RSU API)
|
|
57
|
+
setItems(result.data);
|
|
58
|
+
}
|
|
59
|
+
else if (result.success && Array.isArray(result.data)) {
|
|
60
|
+
// Format 3: { success: true, data: [...] }
|
|
61
|
+
setItems(result.data);
|
|
62
|
+
}
|
|
63
|
+
else if (result.data && Array.isArray(result.data)) {
|
|
64
|
+
// Format 4: { data: [...] }
|
|
51
65
|
setItems(result.data);
|
|
52
66
|
}
|
|
53
67
|
else {
|
|
68
|
+
console.error('Format de réponse non reconnu:', result);
|
|
54
69
|
throw new Error('Format de réponse invalide');
|
|
55
70
|
}
|
|
56
71
|
}
|
package/package.json
CHANGED