@rsuci/shared-form-components 1.0.11 → 1.0.12

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":"RosterPanel.d.ts","sourceRoot":"","sources":["../../../src/components/roster/RosterPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAGD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAGD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,YAAY,CAAC;IACrB,eAAe,EAAE,cAAc,EAAE,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,QAAQ,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C;AAED,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAyH3C,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"RosterPanel.d.ts","sourceRoot":"","sources":["../../../src/components/roster/RosterPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAGD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAGD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,YAAY,CAAC;IACrB,eAAe,EAAE,cAAc,EAAE,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,QAAQ,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C;AAED,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAuI3C,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -19,23 +19,33 @@ const RosterPanel = ({ option, rosterVariables, value, onChange, disabled, showC
19
19
  // Récupérer les options (format: "01#Option1|02#Option2|...")
20
20
  const optionsValue = rosterVar.valeurDefaut || rosterVar.valeur;
21
21
  // Déterminer le type de la variable avec fallback intelligent
22
- // Si typeCode est absent mais qu'on a des options au format "##|##", c'est probablement un RADIO
22
+ // Si typeCode est absent, on essaie de déduire le type
23
23
  let effectiveTypeCode = rosterVar.typeCode;
24
- if (!effectiveTypeCode && optionsValue && typeof optionsValue === 'string') {
25
- // Vérifier si c'est un format d'options : "01#Label1|02#Label2"
26
- if (optionsValue.includes('#') && optionsValue.includes('|')) {
27
- // Si peu d'options (2-3), probablement RADIO, sinon LISTE
28
- const optionsCount = optionsValue.split('|').length;
29
- effectiveTypeCode = optionsCount <= 4 ? 'RADIO' : 'LISTE';
30
- console.log(`[RosterPanel] Fallback typeCode pour ${rosterVar.code}: ${effectiveTypeCode} (${optionsCount} options)`);
24
+ if (!effectiveTypeCode) {
25
+ const designation = (rosterVar.designation || '').toLowerCase();
26
+ if (optionsValue && typeof optionsValue === 'string') {
27
+ // Vérifier si c'est un format d'options : "01#Label1|02#Label2"
28
+ if (optionsValue.includes('#') && optionsValue.includes('|')) {
29
+ // Si peu d'options (2-4), probablement RADIO, sinon LISTE
30
+ const optionsCount = optionsValue.split('|').length;
31
+ effectiveTypeCode = optionsCount <= 4 ? 'RADIO' : 'LISTE';
32
+ console.log(`[RosterPanel] Fallback typeCode pour ${rosterVar.code}: ${effectiveTypeCode} (${optionsCount} options)`);
33
+ }
31
34
  }
32
- else {
33
- effectiveTypeCode = 'STRING';
35
+ // Si toujours pas de type, essayer de déduire par le libellé
36
+ if (!effectiveTypeCode) {
37
+ // Patterns pour détecter les types numériques
38
+ const numericPatterns = ['âge', 'age', 'nombre', 'quantité', 'montant', 'prix', 'taille', 'poids', 'année', 'annee', 'mois', 'jour', 'durée', 'duree', 'distance', 'superficie', 'effectif', 'score', 'note', 'pourcentage', '%'];
39
+ const isNumeric = numericPatterns.some(pattern => designation.includes(pattern));
40
+ if (isNumeric) {
41
+ effectiveTypeCode = 'NUMERIQUE';
42
+ console.log(`[RosterPanel] Fallback typeCode pour ${rosterVar.code}: NUMERIQUE (détecté par libellé)`);
43
+ }
44
+ else {
45
+ effectiveTypeCode = 'STRING';
46
+ }
34
47
  }
35
48
  }
36
- else if (!effectiveTypeCode) {
37
- effectiveTypeCode = 'STRING';
38
- }
39
49
  const variable = {
40
50
  id: 0, // Pas d'ID propre pour les variables roster
41
51
  code: uniqueCode, // Code unique par panel
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsuci/shared-form-components",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "Composants partagés de rendu de formulaires RSU v2 - Package local pour frontend Admin et Public",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",