Skip to content
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

Migrate types from inputTypes of evolution-generator to WidgetConfig of evolution-common #831

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

samuel-duhaime
Copy link
Collaborator

@samuel-duhaime samuel-duhaime commented Dec 18, 2024

Pull request

fix #532
Note: I still need to remove inputTypes, and migrate all the useful types.

Description

Migrate types from inputTypes of evolution-generator to WidgetConfig of evolution-common
Breaking changes: Validations type is now ValidationFunction Many types from inputTypes are now in WidgetConfig. You need to do 'yarn generateSurvey' for the Generator surveys

…of evolution-common

Fix #532
Breaking changes: Validations type is now ValidationFunction
Many types from inputTypes are now in WidgetConfig.
You need to do 'yarn generateSurvey' for the Generator surveys
@samuel-duhaime samuel-duhaime force-pushed the takeGoodTypesForGenerator branch from 495e2fa to b00f1bc Compare December 18, 2024 22:12
@@ -414,7 +423,7 @@ export type GroupConfig = {
/** Whether to show a specific grouped object
* FIXME: Is this redundant with filter?
*/
groupedObjectConditional?: boolean | ParsingFunction<boolean>;
groupedObjectConditional?: Conditional;
Copy link
Contributor

Choose a reason for hiding this comment

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

Dans ce cas-ci, ce n'est pas le même type de conditionnelle, ça ne peut pas retourner un array comme les autres avec valeur par défaut, il faut garder comme avant.

@@ -432,10 +441,10 @@ export type GroupConfig = {
groupedObjectDeleteButtonLabel?: I18nData;
deleteConfirmPopup?: {
content: I18nData;
conditional?: boolean | ParsingFunction<boolean>;
conditional?: Conditional;
Copy link
Contributor

Choose a reason for hiding this comment

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

Idem ici, malgré le nom du champ, on s'attend à recevoir un booléen uniquement, jamais un array.

en: 'Age is invalid.'
}
},
{
validation: Number(value) < 0,
errorMessage: {
fr: 'L\'âge doit être au moins de 0.',
fr: "L'âge doit être au moins de 0.",
Copy link
Contributor

Choose a reason for hiding this comment

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

Je ne crois pas que le formatage va permettre ces changements...

};

// This represent if it's active (true) or not (false)
export type Conditional = boolean | ParsingFunction<boolean | [boolean] | [boolean, unknown]>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Ce serait peut-être mieux de nommer ce type WidgetConditional, pour expliciter le fait que c'est une conditionnelle du type pour un widget, donc avec potentielle valeur par défaut, alors qu'un type Conditional serait uniquement booléen.

Copy link
Contributor

Choose a reason for hiding this comment

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

Aussi, en voyant les test failures, le type WidgetConditional devrait être juste une ParsingFunction, pas de booléen seulement. Tant qu'à mettre un booléen false, il faudrait désactiver le widget à la source, en le commentant dans la configuration de la section ou du groupe.

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.

generator: Use types and function from the with the main evolution packages
2 participants