8000 fix: problem letters allowed in widget number by andriacap · Pull Request #3478 · PnX-SI/GeoNature · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: problem letters allowed in widget number #3478

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

andriacap
Copy link
Contributor
@andriacap andriacap commented Apr 25, 2025
  • add another widget using type text with validators as number
  • create a generic component to display validation error messages
  • use this generic component in the dynamic form component
  • add a service to manage the messages
  • add messages in the i18n files
  • add accessor get for the form control

Closes : #3480
Reviewed-by: andriacap

Copy link
codecov bot commented Apr 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.23%. Comparing base (c557d1d) to head (c7ac108).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3478      +/-   ##
===========================================
- Coverage    84.25%   84.23%   -0.02%     
===========================================
  Files          132      132              
  Lines        10301    10301              
===========================================
- Hits          8679     8677       -2     
- Misses        1622     1624       +2     
Flag Coverage Δ
pytest 84.23% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@andriacap andriacap force-pushed the fix/input-number-widget-allows-letters branch 2 times, most recently from 4c5ff4c to a1a8bce Compare April 28, 2025 08:47
Comment on lines 10 to 24
required : 'Ce champ est obligatoire.',
minlength : 'Le texte doit contenir au moins {{requiredLength}} caractères (actuellement {{actualLength}}).',
maxlength : 'Le texte doit contenir au plus {{requiredLength}} caractères (actuellement {{actualLength}}).',
pattern : 'Valeur non valide.',
min : 'La valeur doit être ≥ {{min}} (actuellement {{actual}}).',
max : 'La valeur doit être ≤ {{max}} (actuellement {{actual}}).',

//validateurs custom
[ValidationErrorsId.ARRAY_MIN_LENGTH_ERROR]: 'Il faut au moins {{arrayLength}} éléments.',
[ValidationErrorsId.IS_OBJECT_ERROR] : 'Format d’objet invalide.',
[ValidationErrorsId.MIN_GREATER_THAN_MAX] : 'Le minimum doit être ≤ le maximum.',
[ValidationErrorsId.NOT_NUMBER_ERROR] : 'Le champ doit être un nombre valide.',
[ValidationErrorsId.COMMA_NOT_ALLOWED] : 'Le champ de type nombre ne doit pas contenir de virgule. Utilisez le point pour la décimale.',
file : 'Le fichier est trop volumineux.',
medias : 'Format de médias invalide.',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doublons ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes en l'occurence toutes les erreurs sont référencées dans les fichiers de traductions. J'avais mis un objet de messages d'erreurs par défaut au cas où la traduction n'était pas bien remplie . Donc yes ça peut être enlevé

Copy link
Contributor Author
@andriacap andriacap Apr 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A savoir que j'ai testé sur min ,max , format de nombre , utilisation de "," dans les nombres décimaux . J'ai pas reproduis les erreurs sur les autres validateurs .

A l'origine la PR proposait juste de "fix" les problèmes de remplissage des input de type "number" avec des lettres (sur firefox c'est autorisé , tandis que sur chrome il interdit l'ajout de lettre dans ces input de type number) . Mais vu que je voulais proposer un développement qui pouvait être réutilisé et générique , j'ai intégré les autres validations qui sont ajoutées dans le composant dynamicform )

@andriacap andriacap marked this pull request as ready for review April 28, 2025 11:12
andriacap added 4 commits May 12, 2025 14:50
- add another widget using type text with validators as number
- create a generic component to display validation error messages
- use this generic component in the dynamic form component
- add a service to manage the messages
- add messages in the i18n files
- add accessor get for the form control

Reviewed-by: andriacap
- Refact number and txt_number for adding validators
- Add control on comma in number input / txt_number widget

Reviewed-by: andriacap
- Don't allow letters in input txt_number widget (10a not allowed whereas it was before)

Reviewed-by: acapai
@andriacap andriacap force-pushed the fix/input-number-widget-allows-letters branch from a1fbbf2 to c7ac108 Compare May 12, 2025 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0