-
Notifications
You must be signed in to change notification settings - Fork 9
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
base: main
Are you sure you want to change the base?
Conversation
…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
495e2fa
to
b00f1bc
Compare
@@ -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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.", |
There was a problem hiding this comment.
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]>; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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