@rsuci/shared-form-components 1.0.128 → 1.0.129
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.
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Composant ExtraitInput - Saisie d'Extrait de Naissance
|
|
3
3
|
* RSU v2 - Moteur de Rendu des Formulaires d'Enquête
|
|
4
4
|
*
|
|
5
|
-
* Format composé : numéro (
|
|
6
|
-
* Exemple affiché : "
|
|
5
|
+
* Format composé : numéro (1 à 4 chiffres) + date d'établissement + année registre (4 chiffres)
|
|
6
|
+
* Exemple affiché : "1000 du 12/12/2020 du registre 2020"
|
|
7
7
|
* Stockage : JSON { numero, dateEtablissement, anneeRegistre }
|
|
8
8
|
*/
|
|
9
9
|
import React from 'react';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExtraitInput.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/ExtraitInput.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAA2C,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIxE,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,kBAAkB,GAAG;QAAE,QAAQ,EAAE,SAAS,CAAA;KAAE,CAAC;IACvD,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAgED,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,
|
|
1
|
+
{"version":3,"file":"ExtraitInput.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/ExtraitInput.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAA2C,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIxE,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,kBAAkB,GAAG;QAAE,QAAQ,EAAE,SAAS,CAAA;KAAE,CAAC;IACvD,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAgED,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA8I7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groupeInstanceManager.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/groupeInstanceManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,cAAc,EAEd,0BAA0B,EAE3B,MAAM,qBAAqB,CAAC;AAE7B,qBAAa,qBAAqB;IAEhC;;;OAGG;IACH,MAAM,CAAC,eAAe,CACpB,MAAM,EAAE,gBAAgB,EACxB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,GACxC,MAAM;IAsCT;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM;IASxD;;;;OAIG;IACH,MAAM,CAAC,iBAAiB,CACtB,MAAM,EAAE,gBAAgB,EACxB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,GACxC,MAAM;IAuBT;;OAEG;IACH,MAAM,CAAC,cAAc,CACnB,MAAM,EAAE,gBAAgB,EACxB,cAAc,EAAE,MAAM,GACrB,cAAc;IAWjB;;OAEG;IACH,MAAM,CAAC,mBAAmB,CACxB,MAAM,EAAE,gBAAgB,EACxB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,GACxC,cAAc,EAAE;
|
|
1
|
+
{"version":3,"file":"groupeInstanceManager.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/groupeInstanceManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,cAAc,EAEd,0BAA0B,EAE3B,MAAM,qBAAqB,CAAC;AAE7B,qBAAa,qBAAqB;IAEhC;;;OAGG;IACH,MAAM,CAAC,eAAe,CACpB,MAAM,EAAE,gBAAgB,EACxB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,GACxC,MAAM;IAsCT;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM;IASxD;;;;OAIG;IACH,MAAM,CAAC,iBAAiB,CACtB,MAAM,EAAE,gBAAgB,EACxB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,GACxC,MAAM;IAuBT;;OAEG;IACH,MAAM,CAAC,cAAc,CACnB,MAAM,EAAE,gBAAgB,EACxB,cAAc,EAAE,MAAM,GACrB,cAAc;IAWjB;;OAEG;IACH,MAAM,CAAC,mBAAmB,CACxB,MAAM,EAAE,gBAAgB,EACxB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,GACxC,cAAc,EAAE;IA6FnB;;OAEG;IACH,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO;IAStF;;OAEG;IACH,MAAM,CAAC,cAAc,CACnB,MAAM,EAAE,gBAAgB,EACxB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,GACxC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AM,EAAE,cAAc,CAAC,GACxC;QACD,OAAO,EAAE,OAAO,CAAC;QACjB,cAAc,EAAE,gBAAgB,EAAE,CAAC;QACnC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;QACjD,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB;IAgED;;;OAGG;IACH,MAAM,CAAC,wBAAwB,CAC7B,UAAU,EAAE,gBAAgB,EAAE,EAC9B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,GACxC,gBAAgB,EAAE;CAqDtB"}
|
|
@@ -107,20 +107,19 @@ export class GroupeInstanceManager {
|
|
|
107
107
|
// Note: le parsing de clé par format "CODE_NUMERO" a été supprimé car il
|
|
108
108
|
// produisait des faux positifs pour les codes variables contenant des chiffres (ex: S1_01)
|
|
109
109
|
const maxInstances = this.getMaxInstances(groupe, responses);
|
|
110
|
-
//
|
|
111
|
-
|
|
112
|
-
//
|
|
113
|
-
//
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
110
|
+
// Borne supérieure : au moins maxInstances (variable de contrôle), au moins le
|
|
111
|
+
// numéro le plus élevé trouvé dans les réponses (protège contre la perte de données
|
|
112
|
+
// si des réponses existent au-delà de la variable de contrôle, ex: membre 2 vide
|
|
113
|
+
// dans un groupe lié où le numéro max existant est 3).
|
|
114
|
+
const highestExistingMembre = instanceNumbers.size > 0
|
|
115
|
+
? Math.max(...Array.from(instanceNumbers))
|
|
116
|
+
: 0;
|
|
117
|
+
const upperBound = Math.max(maxInstances, highestExistingMembre, 1);
|
|
119
118
|
const instances = [];
|
|
120
119
|
// Séparer les réponses avec et sans numeroMembre
|
|
121
120
|
const responsesWithMember = groupResponses.filter(r => r.numeroMembre);
|
|
122
121
|
const responsesWithoutMember = groupResponses.filter(r => !r.numeroMembre);
|
|
123
|
-
for (let i = 1; i <=
|
|
122
|
+
for (let i = 1; i <= upperBound; i++) {
|
|
124
123
|
const instance = this.createInstance(groupe, i);
|
|
125
124
|
// Remplir les réponses existantes pour cette instance
|
|
126
125
|
groupe.variables.forEach(variable => {
|
|
@@ -287,7 +286,10 @@ export class GroupeInstanceManager {
|
|
|
287
286
|
};
|
|
288
287
|
}
|
|
289
288
|
const currentInstances = groupe.instances || [];
|
|
290
|
-
const
|
|
289
|
+
const maxExisting = currentInstances.length > 0
|
|
290
|
+
? Math.max(...currentInstances.map(i => i.numeroInstance))
|
|
291
|
+
: 0;
|
|
292
|
+
const newInstanceNumber = maxExisting + 1;
|
|
291
293
|
const newInstance = this.createInstance(groupe, newInstanceNumber);
|
|
292
294
|
// Construire un nouveau groupe avec l'instance ajoutée (sans muter l'original)
|
|
293
295
|
const updatedInstances = [...currentInstances, newInstance];
|
|
@@ -621,32 +623,42 @@ export class GroupeInstanceManager {
|
|
|
621
623
|
groupsByControlVar.set(g.codeVariable, existing);
|
|
622
624
|
}
|
|
623
625
|
}
|
|
624
|
-
// Pour chaque ensemble de groupes liés, synchroniser
|
|
626
|
+
// Pour chaque ensemble de groupes liés, synchroniser les instances manquantes
|
|
625
627
|
const updatedGroupes = [...allGroupes];
|
|
626
628
|
for (const [, linkedGroups] of groupsByControlVar) {
|
|
627
629
|
if (linkedGroups.length <= 1)
|
|
628
630
|
continue;
|
|
629
|
-
//
|
|
630
|
-
const
|
|
631
|
-
|
|
631
|
+
// Union de tous les numéros d'instances réels à travers les groupes liés
|
|
632
|
+
const allInstanceNumbers = new Set();
|
|
633
|
+
for (const g of linkedGroups) {
|
|
634
|
+
for (const inst of g.instances || []) {
|
|
635
|
+
allInstanceNumbers.add(inst.numeroInstance);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
if (allInstanceNumbers.size === 0)
|
|
632
639
|
continue;
|
|
633
|
-
//
|
|
640
|
+
// Pour chaque groupe, créer uniquement les instances dont le numéro est absent
|
|
641
|
+
// (comparaison par ensemble, pas par longueur — évite les doublons)
|
|
634
642
|
for (const g of linkedGroups) {
|
|
635
|
-
const
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
instancesCount: instances.length
|
|
648
|
-
};
|
|
643
|
+
const existingNumbers = new Set((g.instances || []).map(i => i.numeroInstance));
|
|
644
|
+
const missingNumbers = [...allInstanceNumbers]
|
|
645
|
+
.filter(n => !existingNumbers.has(n))
|
|
646
|
+
.sort((a, b) => a - b);
|
|
647
|
+
if (missingNumbers.length === 0)
|
|
648
|
+
continue;
|
|
649
|
+
const idx = updatedGroupes.findIndex(ug => ug.code === g.code);
|
|
650
|
+
if (idx === -1)
|
|
651
|
+
continue;
|
|
652
|
+
const instances = [...(updatedGroupes[idx].instances || [])];
|
|
653
|
+
for (const num of missingNumbers) {
|
|
654
|
+
instances.push(this.createInstance(g, num));
|
|
649
655
|
}
|
|
656
|
+
instances.sort((a, b) => a.numeroInstance - b.numeroInstance);
|
|
657
|
+
updatedGroupes[idx] = {
|
|
658
|
+
...updatedGroupes[idx],
|
|
659
|
+
instances,
|
|
660
|
+
instancesCount: instances.length
|
|
661
|
+
};
|
|
650
662
|
}
|
|
651
663
|
}
|
|
652
664
|
return updatedGroupes;
|
package/package.json
CHANGED