@rsuci/shared-form-components 1.0.137 → 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.
@@ -1 +1 @@
1
- {"version":3,"file":"FormRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/form-renderer/FormRenderer.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAA4D,MAAM,OAAO,CAAC;AACjF,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;AAuBlF;;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;AAulCD;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAgBpD,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"FormRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/form-renderer/FormRenderer.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAA4D,MAAM,OAAO,CAAC;AACjF,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;AAuBlF;;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;AAylCD;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAgBpD,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -686,7 +686,7 @@ const FormRendererInner = () => {
686
686
  if (!formulaire || !formulaire.groupes || formulaire.groupes.length === 0) {
687
687
  return (_jsx("div", { className: "min-h-screen bg-gray-50 flex items-center justify-center", children: _jsxs("div", { className: "bg-white rounded-lg shadow-sm border border-gray-200 p-8 text-center max-w-md", children: [_jsx("div", { className: "text-red-500 mb-4", children: _jsx("svg", { className: "w-12 h-12 mx-auto", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.732-.833-2.5 0L4.268 18.5c-.77.833.192 2.5 1.732 2.5z" }) }) }), _jsx("h3", { className: "text-lg font-medium text-gray-900 mb-2", children: "Formulaire non configur\u00E9" }), _jsx("p", { className: "text-gray-600 mb-4", children: "Ce formulaire ne contient aucun groupe de variables." }), _jsx("button", { onClick: callbacks.onCancel, className: "inline-flex items-center px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700", children: "Retour" })] }) }));
688
688
  }
689
- return (_jsxs("div", { className: "min-h-screen bg-gray-50", children: [_jsxs("div", { className: "max-w-4xl mx-auto px-4 py-6", children: [_jsxs("div", { className: "bg-white rounded-lg shadow-sm border border-gray-200 p-4 mb-6", children: [_jsx("h1", { className: "text-xl font-semibold text-gray-900 mb-4", children: formulaire.designation }), _jsx(FormProgress, { showPercentage: true })] }), _jsxs("div", { className: "bg-white rounded-lg shadow-sm border border-gray-200 mb-6", children: [_jsx("div", { className: "bg-green-600 px-6 py-4", children: _jsx("h2", { className: "text-xl font-bold text-white uppercase tracking-wide", children: currentGroup?.designation }) }), _jsxs("div", { className: "p-6", children: [currentGroup?.estMultiple && currentGroup.instances && (_jsx("div", { className: "mb-6", children: _jsx(GroupeInstanceTabs, { groupe: currentGroup, currentInstanceIndex: navigation.navigationState.instanceIndex, responses: responses, onInstanceChange: handleInstanceChange, onInstanceAdded: handleInstanceAdded, onInstanceRemoved: handleInstanceRemoved, disabled: effectiveDisabled, linkedGroups: GroupeInstanceManager.getLinkedGroups(currentGroup, groupesWithInstances) }) })), _jsx("div", { className: "space-y-6", children: visibleVariables.map(variable => {
689
+ return (_jsxs("div", { className: "min-h-screen bg-gray-50", children: [_jsxs("div", { className: "max-w-4xl mx-auto px-4 py-6", children: [_jsxs("div", { className: "bg-white rounded-lg shadow-sm border border-gray-200 p-4 mb-6", children: [_jsx("h1", { className: "text-xl font-semibold text-gray-900 mb-4", children: formulaire.designation }), _jsx(FormProgress, { showPercentage: true })] }), _jsxs("div", { className: "bg-white rounded-lg shadow-sm border border-gray-200 mb-6", children: [_jsx("div", { className: "bg-green-600 px-6 py-4", children: _jsx("h2", { className: "text-xl font-bold text-white uppercase tracking-wide", children: currentGroup?.designation }) }), _jsxs("div", { className: "p-6", children: [currentGroup?.estMultiple && currentGroup.instances && (_jsx("div", { className: "mb-6", children: _jsx(GroupeInstanceTabs, { groupe: currentGroup, currentInstanceIndex: navigation.navigationState.instanceIndex, responses: responses, onInstanceChange: handleInstanceChange, onInstanceAdded: handleInstanceAdded, onInstanceRemoved: handleInstanceRemoved, disabled: effectiveDisabled, linkedGroups: GroupeInstanceManager.getLinkedGroups(currentGroup, groupesWithInstances), validateInstance: validateGroupForInstance }) })), _jsx("div", { className: "space-y-6", children: visibleVariables.map(variable => {
690
690
  const responseKey = currentGroup?.estMultiple && currentInstance?.numeroInstance
691
691
  ? `${variable.code}_${currentInstance.numeroInstance}`
692
692
  : variable.code;
@@ -708,7 +708,7 @@ const FormRendererInner = () => {
708
708
  : responsesByVariableCode.get(variable.code)?.numeroMembre, conditionValidationError: getConditionErrorForVariable(variable.code, currentGroup?.estMultiple
709
709
  ? currentInstance?.numeroInstance
710
710
  : responsesByVariableCode.get(variable.code)?.numeroMembre), services: services, geographicComponents: geographicComponents, formulaireVariables: formulaire.variables, formulaireGroupes: groupesWithInstances.length > 0 ? groupesWithInstances : formulaire?.groupes, allResponses: responses, reponses: responses, interpolateVariableLabel: interpolateVariableLabel, rosterVariables: rosterVariables, RosterCheckInput: RosterCheckInput, RosterListInput: RosterListInput, onFillFormFromEnquete: handleFillFormFromEnquete }, variable.id));
711
- }) }), currentGroup?.estMultiple && currentGroup.instances && (_jsx("div", { className: "mt-6 pt-6 border-t", children: _jsx(GroupeInstanceTabs, { groupe: currentGroup, currentInstanceIndex: navigation.navigationState.instanceIndex, responses: responses, onInstanceChange: handleInstanceChange, onInstanceAdded: handleInstanceAdded, onInstanceRemoved: handleInstanceRemoved, disabled: effectiveDisabled, linkedGroups: GroupeInstanceManager.getLinkedGroups(currentGroup, groupesWithInstances) }) }))] })] }), _jsx("div", { className: "bg-white rounded-lg shadow-sm border border-gray-200 p-4", children: _jsxs("div", { className: "flex flex-wrap justify-between items-center gap-2", children: [_jsxs("div", { className: "flex flex-wrap gap-2", children: [_jsxs("button", { type: "button", onClick: handlePrevious, disabled: navigation.isFirstGroup || (!isConsultationMode && effectiveDisabled), className: `flex items-center px-4 py-2 rounded-lg font-medium transition-colors ${!navigation.isFirstGroup && (isConsultationMode || !effectiveDisabled)
711
+ }) }), currentGroup?.estMultiple && currentGroup.instances && (_jsx("div", { className: "mt-6 pt-6 border-t", children: _jsx(GroupeInstanceTabs, { groupe: currentGroup, currentInstanceIndex: navigation.navigationState.instanceIndex, responses: responses, onInstanceChange: handleInstanceChange, onInstanceAdded: handleInstanceAdded, onInstanceRemoved: handleInstanceRemoved, disabled: effectiveDisabled, linkedGroups: GroupeInstanceManager.getLinkedGroups(currentGroup, groupesWithInstances), validateInstance: validateGroupForInstance }) }))] })] }), _jsx("div", { className: "bg-white rounded-lg shadow-sm border border-gray-200 p-4", children: _jsxs("div", { className: "flex flex-wrap justify-between items-center gap-2", children: [_jsxs("div", { className: "flex flex-wrap gap-2", children: [_jsxs("button", { type: "button", onClick: handlePrevious, disabled: navigation.isFirstGroup || (!isConsultationMode && effectiveDisabled), className: `flex items-center px-4 py-2 rounded-lg font-medium transition-colors ${!navigation.isFirstGroup && (isConsultationMode || !effectiveDisabled)
712
712
  ? 'bg-orange-500 text-white hover:bg-orange-600'
713
713
  : 'bg-gray-100 text-gray-400 cursor-not-allowed'}`, children: [_jsx("svg", { className: "h-4 w-4 mr-2", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) }), _jsx("span", { className: "hidden sm:inline", children: labels.previousButton || 'Précédent' }), _jsx("span", { className: "sm:hidden", children: "Pr\u00E9c." })] }), mode === 'admin' && features?.saveDraft && callbacks.onSaveDraft && (_jsx("button", { type: "button", onClick: handleSaveDraft, disabled: effectiveDisabled || isSavingDraft || isSubmitting || isSubmittingForm, className: `flex items-center px-4 py-2 rounded-lg font-medium transition-colors ${!effectiveDisabled && !isSavingDraft && !isSubmitting && !isSubmittingForm
714
714
  ? 'bg-yellow-500 text-white hover:bg-yellow-600'
@@ -14,6 +14,11 @@ export interface GroupeInstanceTabsProps {
14
14
  disabled?: boolean;
15
15
  /** Groupes liés par la même variable de contrôle (pour warning cross-groupe) */
16
16
  linkedGroups?: GroupeFormulaire[];
17
+ /** Validation FormTree (visibilité, jumps, type-aware) — prioritaire sur isInstanceComplete */
18
+ validateInstance?: (groupeCode: string, instanceNumber: number) => {
19
+ isValid: boolean;
20
+ errors: string[];
21
+ };
17
22
  }
18
23
  declare const GroupeInstanceTabs: React.FC<GroupeInstanceTabsProps>;
19
24
  export default GroupeInstanceTabs;
@@ -1 +1 @@
1
- {"version":3,"file":"GroupeInstanceTabs.d.ts","sourceRoot":"","sources":["../../../src/components/form-renderer/GroupeInstanceTabs.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAIvF,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,gBAAgB,CAAC;IACzB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC1C,gBAAgB,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,eAAe,EAAE,CAAC,QAAQ,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACrF,iBAAiB,EAAE,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O,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CAC3G;AAED,QAAA,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA0RzD,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -8,7 +8,7 @@ import { useState, useEffect } from 'react';
8
8
  import { Plus, Minus, AlertTriangle, Check, AlertCircle, AlertTriangle as ExclamationIcon } from 'lucide-react';
9
9
  import { GroupeInstanceManager } from '../../lib/utils/groupeInstanceManager';
10
10
  import ConfirmationModal from './ConfirmationModal';
11
- const GroupeInstanceTabs = ({ groupe, currentInstanceIndex, responses, onInstanceChange, onInstanceAdded, onInstanceRemoved, disabled = false, linkedGroups }) => {
11
+ const GroupeInstanceTabs = ({ groupe, currentInstanceIndex, responses, onInstanceChange, onInstanceAdded, onInstanceRemoved, disabled = false, linkedGroups, validateInstance }) => {
12
12
  const [isProcessing, setIsProcessing] = useState(false);
13
13
  const [error, setError] = useState(null);
14
14
  const [forceUpdate, setForceUpdate] = useState(0);
@@ -39,6 +39,12 @@ const GroupeInstanceTabs = ({ groupe, currentInstanceIndex, responses, onInstanc
39
39
  if (responseCount === 0) {
40
40
  return 'empty';
41
41
  }
42
+ // Utiliser la validation FormTree quand disponible (gère visibilité, jumps, types)
43
+ if (validateInstance) {
44
+ const { isValid } = validateInstance(groupe.code, instance.numeroInstance);
45
+ return isValid ? 'complete' : 'incomplete';
46
+ }
47
+ // Fallback sans FormTree
42
48
  if (GroupeInstanceManager.isInstanceComplete(instance, groupe)) {
43
49
  return 'complete';
44
50
  }
@@ -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;AAGlE,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,OAAO;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,IAAI,CAAC;IAChB,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,qBAAa,sBAAsB;IAEjC;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,IAAI,EAAE,YAAY,GAAG,aAAa;IA4EjF;;OAEG;IACH,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,YAAY,GAAG,MAAM;IAsElE,OAAO,CA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E,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
- return allVarCodes.every(code => {
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsuci/shared-form-components",
3
- "version": "1.0.137",
3
+ "version": "1.0.139",
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",