@rsuci/shared-form-components 1.0.70 → 1.0.72
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.
- package/dist/components/inputs/RadioInput.js +1 -1
- package/dist/components/inputs/SelectInput.js +2 -2
- package/dist/components/selectors/EnqueteInput.js +2 -2
- package/dist/components/selectors/MenageInput.js +2 -2
- package/dist/components/selectors/RSUInput.js +2 -2
- package/dist/lib/utils/variableValueConverter.d.ts.map +1 -1
- package/dist/lib/utils/variableValueConverter.js +11 -5
- package/package.json +1 -1
|
@@ -20,6 +20,6 @@ const RadioInput = ({ variable, value, onChange, onBlur, error, disabled, isCons
|
|
|
20
20
|
const handleChange = (selectedValue) => {
|
|
21
21
|
onChange(selectedValue || null);
|
|
22
22
|
};
|
|
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" }),
|
|
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 }))] }));
|
|
24
24
|
};
|
|
25
25
|
export default RadioInput;
|
|
@@ -40,9 +40,9 @@ const SelectInput = ({ variable, value, onChange, onBlur, error, disabled, isCon
|
|
|
40
40
|
if (onBlur)
|
|
41
41
|
onBlur();
|
|
42
42
|
};
|
|
43
|
-
// Format d'affichage:
|
|
43
|
+
// Format d'affichage: Designation uniquement
|
|
44
44
|
const formatOptionLabel = (option) => {
|
|
45
|
-
return
|
|
45
|
+
return option.designation;
|
|
46
46
|
};
|
|
47
47
|
// Affichage avec SearchableSelect pour beaucoup d'options (>5)
|
|
48
48
|
return (_jsxs("div", { className: "space-y-2", style: containerStyle, children: [_jsx(SearchableSelect, { options: selectOptions, value: selectedOption, onChange: handleChange, placeholder: "S\u00E9lectionner...", searchPlaceholder: "Rechercher...", disabled: effectiveDisabled, required: variable.estObligatoire, error: error, formatOptionLabel: formatOptionLabel, noOptionsMessage: "Aucune option trouv\u00E9e" }), selectedValue && selectedOption && (_jsx("div", { className: "p-2 bg-green-50 border border-green-200 rounded text-sm", children: _jsxs("span", { className: "text-green-800", style: textStyle, children: ["S\u00E9lectionn\u00E9: ", selectedOption.designation] }) }))] }));
|
|
@@ -46,9 +46,9 @@ const EnqueteInput = ({ variable, value, onChange, error, disabled, onFillFormFr
|
|
|
46
46
|
// pour éviter les re-renders et la création d'une nouvelle enquête.
|
|
47
47
|
// Il doit être appelé manuellement si nécessaire (bouton séparé).
|
|
48
48
|
};
|
|
49
|
-
// Format d'affichage:
|
|
49
|
+
// Format d'affichage: Designation uniquement
|
|
50
50
|
const formatOptionLabel = (option) => {
|
|
51
|
-
return
|
|
51
|
+
return option.designation;
|
|
52
52
|
};
|
|
53
53
|
return (_jsx(SearchableSelect, { options: options, value: selectedOption, onChange: handleChange, placeholder: "S\u00E9lectionner une enqu\u00EAte...", searchPlaceholder: "Rechercher une enqu\u00EAte...", disabled: disabled, required: variable.estObligatoire, loading: loading, error: loadError || error, formatOptionLabel: formatOptionLabel, noOptionsMessage: loading ? "Chargement..." : "Aucune enquête trouvée" }));
|
|
54
54
|
};
|
|
@@ -46,9 +46,9 @@ const MenageInput = ({ variable, value, onChange, error, disabled, onFillFormFro
|
|
|
46
46
|
// pour éviter les re-renders et la création d'une nouvelle enquête.
|
|
47
47
|
// Il doit être appelé manuellement si nécessaire (bouton séparé).
|
|
48
48
|
};
|
|
49
|
-
// Format d'affichage:
|
|
49
|
+
// Format d'affichage: Designation uniquement
|
|
50
50
|
const formatOptionLabel = (option) => {
|
|
51
|
-
return
|
|
51
|
+
return option.designation;
|
|
52
52
|
};
|
|
53
53
|
return (_jsx(SearchableSelect, { options: options, value: selectedOption, onChange: handleChange, placeholder: "S\u00E9lectionner un m\u00E9nage...", searchPlaceholder: "Rechercher un m\u00E9nage...", disabled: disabled, required: variable.estObligatoire, loading: loading, error: loadError || error, formatOptionLabel: formatOptionLabel, noOptionsMessage: loading ? "Chargement..." : "Aucun ménage trouvé" }));
|
|
54
54
|
};
|
|
@@ -43,9 +43,9 @@ const RSUInput = ({ variable, value, onChange, error, disabled, services }) => {
|
|
|
43
43
|
const newStructureId = option?.id;
|
|
44
44
|
onChange(newStructureId?.toString() || null);
|
|
45
45
|
};
|
|
46
|
-
// Format d'affichage:
|
|
46
|
+
// Format d'affichage: Designation uniquement
|
|
47
47
|
const formatOptionLabel = (option) => {
|
|
48
|
-
return
|
|
48
|
+
return option.designation;
|
|
49
49
|
};
|
|
50
50
|
return (_jsx(SearchableSelect, { options: options, value: selectedOption, onChange: handleChange, placeholder: "S\u00E9lectionner une structure RSU...", searchPlaceholder: "Rechercher une structure...", disabled: disabled, required: variable.estObligatoire, loading: loading, error: loadError || error, formatOptionLabel: formatOptionLabel, noOptionsMessage: loading ? "Chargement..." : "Aucune structure trouvée" }));
|
|
51
51
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variableValueConverter.d.ts","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EAAE,IAAI,EAAE,YAAY,GAAG,OAAO;IA4ChE;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,YAAY,GAAG,MAAM;CAsC1E"}
|
|
@@ -407,7 +407,7 @@ export class VariableValueConverter {
|
|
|
407
407
|
static optionsToSelectFormat(options) {
|
|
408
408
|
return options.map(option => ({
|
|
409
409
|
value: option.code,
|
|
410
|
-
label:
|
|
410
|
+
label: option.designation,
|
|
411
411
|
disabled: false
|
|
412
412
|
}));
|
|
413
413
|
}
|
|
@@ -468,12 +468,18 @@ export class VariableValueConverter {
|
|
|
468
468
|
break;
|
|
469
469
|
case 'DATEHEURE':
|
|
470
470
|
if (value instanceof Date) {
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
}
|
|
471
|
+
const dtDate = value.toLocaleDateString('fr-FR');
|
|
472
|
+
const dtH = value.getHours().toString().padStart(2, '0');
|
|
473
|
+
const dtM = value.getMinutes().toString().padStart(2, '0');
|
|
474
|
+
return `${dtDate} ${dtH} H ${dtM} min`;
|
|
475
475
|
}
|
|
476
476
|
break;
|
|
477
|
+
case 'HOUR':
|
|
478
|
+
if (typeof value === 'string' && value.includes(':')) {
|
|
479
|
+
const [h, m] = value.split(':');
|
|
480
|
+
return `${h.padStart(2, '0')} H ${m.padStart(2, '0')} min`;
|
|
481
|
+
}
|
|
482
|
+
return String(value);
|
|
477
483
|
case 'NUMERIQUE':
|
|
478
484
|
if (typeof value === 'number') {
|
|
479
485
|
return value.toLocaleString('fr-FR');
|
package/package.json
CHANGED