@rsuci/shared-form-components 1.0.138 → 1.0.139
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.
|
@@ -94,6 +94,8 @@ export declare class VariableValueConverter {
|
|
|
94
94
|
*/
|
|
95
95
|
static hasRequiredRosterValue(typeCode: 'ROSTERCHECK' | 'ROSTERLIST', value: VariableValue, optionsSource: string | null | undefined, rosterVariables: Array<{
|
|
96
96
|
code: string;
|
|
97
|
+
ordre?: number;
|
|
98
|
+
conditionsAffichage?: string;
|
|
97
99
|
}>): boolean;
|
|
98
100
|
/**
|
|
99
101
|
* Façade unifiée : appelle hasRequiredRosterValue pour les rosters,
|
|
@@ -101,6 +103,8 @@ export declare class VariableValueConverter {
|
|
|
101
103
|
*/
|
|
102
104
|
static hasRequiredValueForVariable(typeCode: VariableType | string, value: VariableValue, optionsSource?: string | null, rosterVariables?: Array<{
|
|
103
105
|
code: string;
|
|
106
|
+
ordre?: number;
|
|
107
|
+
conditionsAffichage?: string;
|
|
104
108
|
}>): boolean;
|
|
105
109
|
/**
|
|
106
110
|
* Parse la configuration d'une variable COLLECTION.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variableValueConverter.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/variableValueConverter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"variableValueConverter.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/variableValueConverter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIlE,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,OAAO;IACtB,QAAQ,EAAE,MAAM,CAAC;IACj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,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,mBAAmB,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GACtF,OAAO;IAWV;;;;OAIG;IACH,MAAM,CAAC,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,IAAI;IAUpG;;;OAGG;IACH,MAAM,CAAC,6BAA6B,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM;IAOjF;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,YAAY,GAAG,MAAM;CAsC1E"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Toutes les valeurs sont stockées comme string dans la base de données
|
|
4
4
|
* RSU v2 - Moteur de Rendu des Formulaires d'Enquête
|
|
5
5
|
*/
|
|
6
|
+
import { RosterConditionEngine } from '../roster-condition-engine';
|
|
6
7
|
/**
|
|
7
8
|
* Classe utilitaire pour la conversion des valeurs de variables
|
|
8
9
|
*/
|
|
@@ -628,10 +629,35 @@ export class VariableValueConverter {
|
|
|
628
629
|
if (allVarCodes.length === 0) {
|
|
629
630
|
return Object.keys(data).length > 0;
|
|
630
631
|
}
|
|
632
|
+
// Calcule les codes visibles pour une option donnée (conditions + jumps)
|
|
633
|
+
const getVisibleVarCodes = (optionValues) => {
|
|
634
|
+
const sortedVars = rosterVariables
|
|
635
|
+
.filter(rv => rv.ordre !== undefined)
|
|
636
|
+
.sort((a, b) => (a.ordre ?? 0) - (b.ordre ?? 0));
|
|
637
|
+
if (sortedVars.length === 0)
|
|
638
|
+
return allVarCodes;
|
|
639
|
+
const jumped = RosterConditionEngine.computeJumpedVariables(sortedVars.map(v => ({
|
|
640
|
+
code: v.code,
|
|
641
|
+
ordre: v.ordre,
|
|
642
|
+
conditionsAffichage: v.conditionsAffichage,
|
|
643
|
+
})), optionValues);
|
|
644
|
+
return sortedVars
|
|
645
|
+
.filter(rv => {
|
|
646
|
+
if (jumped.has(rv.code))
|
|
647
|
+
return false;
|
|
648
|
+
if (!rv.conditionsAffichage)
|
|
649
|
+
return true;
|
|
650
|
+
return RosterConditionEngine.evaluate(rv.conditionsAffichage, optionValues);
|
|
651
|
+
})
|
|
652
|
+
.map(rv => rv.code);
|
|
653
|
+
};
|
|
631
654
|
const isOptionComplete = (optData) => {
|
|
632
655
|
if (!optData)
|
|
633
656
|
return false;
|
|
634
|
-
|
|
657
|
+
const visibleCodes = getVisibleVarCodes(optData);
|
|
658
|
+
if (visibleCodes.length === 0)
|
|
659
|
+
return true;
|
|
660
|
+
return visibleCodes.every(code => {
|
|
635
661
|
const v = optData[code];
|
|
636
662
|
return v !== null && v !== undefined && v !== '';
|
|
637
663
|
});
|
package/package.json
CHANGED