@rsuci/shared-form-components 1.0.111 → 1.0.113

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;AA48BD;;;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;AA0gCD;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAgBpD,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -243,9 +243,21 @@ const FormRendererInner = () => {
243
243
  const handleFillFormFromEnquete = useCallback((enqueteData) => {
244
244
  if (!enqueteData?.reponses)
245
245
  return;
246
+ // Collecter les codes des variables des groupes contenant MENAGE ou ENQUETE
247
+ // Ces groupes ne doivent pas être écrasés par le chargement de données
248
+ const excludedCodes = new Set();
249
+ for (const groupe of (formulaire.groupes || [])) {
250
+ if (groupe.variables?.some((v) => v.typeCode === 'MENAGE' || v.typeCode === 'ENQUETE')) {
251
+ for (const v of (groupe.variables || [])) {
252
+ excludedCodes.add(v.code);
253
+ }
254
+ }
255
+ }
246
256
  const allVariables = formulaire.variables ||
247
257
  formulaire.groupes?.flatMap((g) => g.variables || []) || [];
248
258
  for (const reponse of enqueteData.reponses) {
259
+ if (excludedCodes.has(reponse.variableCode))
260
+ continue;
249
261
  const variable = allVariables.find((v) => v.code === reponse.variableCode);
250
262
  if (variable) {
251
263
  updateResponse(variable.code, reponse.valeur, variable, reponse.numeroMembre);
@@ -447,6 +459,46 @@ const FormRendererInner = () => {
447
459
  navigation.goToPreviousGroup();
448
460
  }
449
461
  };
462
+ // Nettoyer les réponses avant sauvegarde : supprimer les valeurs des variables masquées (hideMe/showMe/jump)
463
+ // Gère correctement les instances : une variable masquée pour l'instance 2 mais visible pour l'instance 1
464
+ // n'est effacée que pour l'instance 2
465
+ const cleanResponsesForSave = useCallback((responsesToClean) => {
466
+ const keysToRemove = new Set();
467
+ for (const groupe of groupes) {
468
+ if (!groupe.variables)
469
+ continue;
470
+ if (groupe.estMultiple && groupe.instances) {
471
+ // Groupes multiples : vérifier la visibilité par instance
472
+ for (const instance of groupe.instances) {
473
+ const visibleCodes = new Set(getVisibleVariablesForInstance(groupe.code, instance.numeroInstance)
474
+ .map(v => v.code));
475
+ for (const variable of groupe.variables) {
476
+ if (!visibleCodes.has(variable.code)) {
477
+ keysToRemove.add(`${variable.code}_${instance.numeroInstance}`);
478
+ }
479
+ }
480
+ }
481
+ }
482
+ else {
483
+ // Groupes simples : vérifier la visibilité globale
484
+ const visibleCodes = new Set(getVisibleVariables(groupe.code).map(v => v.code));
485
+ for (const variable of groupe.variables) {
486
+ if (!visibleCodes.has(variable.code)) {
487
+ keysToRemove.add(variable.code);
488
+ }
489
+ }
490
+ }
491
+ }
492
+ if (keysToRemove.size === 0)
493
+ return responsesToClean;
494
+ const cleaned = {};
495
+ for (const [key, reponse] of Object.entries(responsesToClean)) {
496
+ if (!keysToRemove.has(key)) {
497
+ cleaned[key] = reponse;
498
+ }
499
+ }
500
+ return cleaned;
501
+ }, [groupes, getVisibleVariables, getVisibleVariablesForInstance]);
450
502
  // Handler pour la soumission
451
503
  const handleSubmit = async () => {
452
504
  if (effectiveDisabled || isSubmitting || isSubmittingForm)
@@ -526,7 +578,7 @@ const FormRendererInner = () => {
526
578
  }
527
579
  setIsSubmittingForm(true);
528
580
  try {
529
- await callbacks.onSubmit(responses);
581
+ await callbacks.onSubmit(cleanResponsesForSave(responses));
530
582
  }
531
583
  finally {
532
584
  setIsSubmittingForm(false);
@@ -538,7 +590,7 @@ const FormRendererInner = () => {
538
590
  return;
539
591
  setIsSavingDraft(true);
540
592
  try {
541
- await callbacks.onSaveDraft(responses);
593
+ await callbacks.onSaveDraft(cleanResponsesForSave(responses));
542
594
  draftJustSavedRef.current = true;
543
595
  setHasUnsavedChanges(false);
544
596
  }
@@ -32,6 +32,6 @@ export const ValidationModal = ({ isOpen, onClose, onConfirm, action, enquetesCo
32
32
  const isValider = action === 'valider';
33
33
  const titre = isValider ? 'Valider l\'enquête' : 'Rejeter l\'enquête';
34
34
  const couleurBouton = isValider ? 'bg-green-600 hover:bg-green-700' : 'bg-red-600 hover:bg-red-700';
35
- return (_jsxs("div", { className: "fixed inset-0 z-50 overflow-y-auto", children: [_jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 transition-opacity", onClick: handleClose }), _jsx("div", { className: "flex min-h-full items-center justify-center p-4", children: _jsxs("div", { className: "relative bg-white rounded-lg shadow-xl max-w-md w-full p-6", children: [_jsxs("div", { className: "flex items-center justify-between mb-4", children: [_jsxs("div", { className: "flex items-center space-x-3", children: [_jsx("div", { className: `${isValider ? 'text-green-600' : 'text-red-600'}`, children: isValider ? (_jsx("svg", { className: "w-6 h-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) })) : (_jsx("svg", { className: "w-6 h-6", 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-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" }) })) }), _jsx("h3", { className: "text-lg font-semibold text-gray-900", children: titre })] }), _jsx("button", { onClick: handleClose, disabled: isSubmitting, className: "text-gray-400 hover:text-gray-600 transition-colors disabled:opacity-50", children: _jsx("svg", { className: "w-5 h-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })] }), _jsxs("div", { className: "mb-6", children: [_jsxs("p", { className: "text-gray-700 mb-4", children: ["\u00CAtes-vous s\u00FBr de vouloir ", isValider ? 'valider' : 'rejeter', ' ', _jsxs("span", { className: "font-semibold", children: [enquetesCount, " enqu\u00EAte", enquetesCount > 1 ? 's' : ''] }), " ?"] }), !isValider && (_jsxs("div", { children: [_jsx("label", { htmlFor: "commentaire", className: "block text-sm font-medium text-gray-700 mb-2", children: "Commentaire (optionnel)" }), _jsx("textarea", { id: "commentaire", value: commentaire, onChange: (e) => setCommentaire(e.target.value), disabled: isSubmitting, rows: 4, className: "w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-red-500 focus:border-red-500 disabled:bg-gray-100 disabled:cursor-not-allowed text-gray-900 placeholder:text-gray-400", placeholder: "Indiquez la raison du rejet (optionnel)..." }), _jsx("p", { className: "mt-1 text-xs text-gray-500", children: "Maximum 500 caract\u00E8res" })] }))] }), _jsxs("div", { className: "flex justify-end space-x-3", children: [_jsx("button", { onClick: handleClose, disabled: isSubmitting, className: "px-4 py-2 text-sm font-medium text-gray-700 bg-gray-100 rounded-lg hover:bg-gray-200 transition-colors disabled:opacity-50 disabled:cursor-not-allowed", children: "Annuler" }), _jsx("button", { onClick: handleConfirm, disabled: isSubmitting, className: `px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed ${couleurBouton}`, children: isSubmitting ? (_jsxs("span", { className: "flex items-center", children: [_jsxs("svg", { className: "animate-spin -ml-1 mr-2 h-4 w-4 text-white", fill: "none", viewBox: "0 0 24 24", children: [_jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }), _jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] }), "Traitement..."] })) : ('Confirmer') })] })] }) })] }));
35
+ return (_jsxs("div", { className: "fixed inset-0 z-50 overflow-y-auto", children: [_jsx("div", { className: "fixed inset-0 bg-black/30 backdrop-blur-sm transition-opacity", onClick: handleClose }), _jsx("div", { className: "flex min-h-full items-center justify-center p-4", children: _jsxs("div", { className: "relative bg-white rounded-lg shadow-xl max-w-md w-full p-6", children: [_jsxs("div", { className: "flex items-center justify-between mb-4", children: [_jsxs("div", { className: "flex items-center space-x-3", children: [_jsx("div", { className: `${isValider ? 'text-green-600' : 'text-red-600'}`, children: isValider ? (_jsx("svg", { className: "w-6 h-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) })) : (_jsx("svg", { className: "w-6 h-6", 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-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" }) })) }), _jsx("h3", { className: "text-lg font-semibold text-gray-900", children: titre })] }), _jsx("button", { onClick: handleClose, disabled: isSubmitting, className: "text-gray-400 hover:text-gray-600 transition-colors disabled:opacity-50", children: _jsx("svg", { className: "w-5 h-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })] }), _jsxs("div", { className: "mb-6", children: [_jsxs("p", { className: "text-gray-700 mb-4", children: ["\u00CAtes-vous s\u00FBr de vouloir ", isValider ? 'valider' : 'rejeter', ' ', _jsxs("span", { className: "font-semibold", children: [enquetesCount, " enqu\u00EAte", enquetesCount > 1 ? 's' : ''] }), " ?"] }), !isValider && (_jsxs("div", { children: [_jsx("label", { htmlFor: "commentaire", className: "block text-sm font-medium text-gray-700 mb-2", children: "Commentaire (optionnel)" }), _jsx("textarea", { id: "commentaire", value: commentaire, onChange: (e) => setCommentaire(e.target.value), disabled: isSubmitting, rows: 4, className: "w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-red-500 focus:border-red-500 disabled:bg-gray-100 disabled:cursor-not-allowed text-gray-900 placeholder:text-gray-400", placeholder: "Indiquez la raison du rejet (optionnel)..." }), _jsx("p", { className: "mt-1 text-xs text-gray-500", children: "Maximum 500 caract\u00E8res" })] }))] }), _jsxs("div", { className: "flex justify-end space-x-3", children: [_jsx("button", { onClick: handleClose, disabled: isSubmitting, className: "px-4 py-2 text-sm font-medium text-gray-700 bg-gray-100 rounded-lg hover:bg-gray-200 transition-colors disabled:opacity-50 disabled:cursor-not-allowed", children: "Annuler" }), _jsx("button", { onClick: handleConfirm, disabled: isSubmitting, className: `px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed ${couleurBouton}`, children: isSubmitting ? (_jsxs("span", { className: "flex items-center", children: [_jsxs("svg", { className: "animate-spin -ml-1 mr-2 h-4 w-4 text-white", fill: "none", viewBox: "0 0 24 24", children: [_jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }), _jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] }), "Traitement..."] })) : ('Confirmer') })] })] }) })] }));
36
36
  };
37
37
  export default ValidationModal;
@@ -1 +1 @@
1
- {"version":3,"file":"RadioInput.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/RadioInput.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAKxE,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,kBAAkB,GAAG;QAAE,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC;IACrD,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;AAED,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAgDzC,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"RadioInput.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/RadioInput.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAKxE,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,kBAAkB,GAAG;QAAE,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC;IACrD,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;AAED,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA2DzC,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -4,6 +4,7 @@
4
4
  */
5
5
  'use client';
6
6
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
+ import { useEffect } from 'react';
7
8
  import { VariableValueConverter } from '../../lib/utils/variableValueConverter';
8
9
  import { applyComponentStyle } from '../../utils/styleUtils';
9
10
  import { isComponentReadonly } from '../../utils/componentStateUtils';
@@ -17,9 +18,19 @@ const RadioInput = ({ variable, value, onChange, onBlur, error, disabled, isCons
17
18
  const options = typeof optionsSource === 'string'
18
19
  ? VariableValueConverter.parseOptionsFromProperty(optionsSource)
19
20
  : [];
21
+ // Sélectionner automatiquement la 1ere option si aucune n'est sélectionnée
22
+ useEffect(() => {
23
+ if (options.length > 0 && (value === null || value === undefined || value === '')) {
24
+ onChange(options[0].code);
25
+ }
26
+ }, [options.length]);
20
27
  const handleChange = (selectedValue) => {
21
28
  onChange(selectedValue || null);
22
29
  };
23
- return (_jsxs("div", { className: "space-y-2", style: containerStyle, children: [_jsx("div", { className: "space-y-2", children: options.map((option) => (_jsxs("label", { className: `flex items-center space-x-3 ${effectiveDisabled ? 'cursor-not-allowed' : 'cursor-pointer'}`, children: [_jsx("input", { type: "radio", name: `radio-${variable.code}`, value: option.code, checked: value === option.code, onChange: (e) => handleChange(e.target.value), onBlur: onBlur, disabled: effectiveDisabled, className: "h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 disabled:opacity-50" }), _jsx("span", { className: `text-sm ${effectiveDisabled ? 'text-gray-400' : 'text-gray-900'}`, style: textStyle, children: option.designation })] }, option.code))) }), options.length === 0 && (_jsx("p", { className: "text-sm text-gray-500", children: "Aucune option disponible" })), error && (_jsx("p", { className: "text-sm text-red-600", children: error }))] }));
30
+ return (_jsxs("div", { className: "space-y-2", style: containerStyle, children: [_jsx("div", { className: "space-y-2", children: options.map((option) => {
31
+ const isSelected = value === option.code;
32
+ return (_jsxs("label", { className: `flex items-center space-x-3 ${effectiveDisabled ? 'cursor-not-allowed' : 'cursor-pointer'}`, children: [_jsx("input", { type: "radio", name: `radio-${variable.code}`, value: option.code, checked: isSelected, onChange: (e) => handleChange(e.target.value), onClick: () => { if (isSelected)
33
+ handleChange(option.code); }, onBlur: onBlur, disabled: effectiveDisabled, className: "h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 disabled:opacity-50" }), _jsx("span", { className: `text-sm ${effectiveDisabled ? 'text-gray-400' : 'text-gray-900'}`, style: textStyle, children: option.designation })] }, option.code));
34
+ }) }), options.length === 0 && (_jsx("p", { className: "text-sm text-gray-500", children: "Aucune option disponible" })), error && (_jsx("p", { className: "text-sm text-red-600", children: error }))] }));
24
35
  };
25
36
  export default RadioInput;
@@ -1 +1 @@
1
- {"version":3,"file":"condition-engine.d.ts","sourceRoot":"","sources":["../../src/lib/condition-engine.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAIvF,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,UAAU,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,OAAO,CAAC;CACxB;AAGD,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,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AAC,SAAS,EAAE,MAAM,GAAG;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;IAwGhF;;OAEG;IACH,uBAAuB,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,EAAE;CAwE5D;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAI,WAAW,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,oBAS3E,CAAC"}
@@ -837,6 +837,14 @@ export class ConditionEngine {
837
837
  return 'null';
838
838
  }
839
839
  if (typeof value === 'string') {
840
+ // Détecter les strings au format date (YYYY-MM-DD ou ISO 8601) et les convertir en Date
841
+ // pour que les comparaisons avec today() fonctionnent correctement
842
+ if (/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2})?/.test(value)) {
843
+ const parsed = new Date(value);
844
+ if (!isNaN(parsed.getTime())) {
845
+ return `new Date("${value}")`;
846
+ }
847
+ }
840
848
  return `"${value.replace(/"/g, '\\"')}"`;
841
849
  }
842
850
  if (typeof value === 'boolean') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsuci/shared-form-components",
3
- "version": "1.0.111",
3
+ "version": "1.0.113",
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",