mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-18 11:44:05 +08:00
fix(@angular-devkit/schematics-cli): prevent bypassing select/checkbox prompts on validation failure
Previously, when a select or checkbox prompt failed validation, it was bypassed, preventing users from correcting their input. This commit ensures that when validation fails, the prompts are re-displayed, allowing users to make the necessary corrections. This improves the user experience and helps avoid unintended selections. Closes #28189
This commit is contained in:
parent
c5ed0b1248
commit
73c2437965
@ -96,6 +96,13 @@ function _createPromptProvider(): schema.PromptProvider {
|
|||||||
)({
|
)({
|
||||||
message: definition.message,
|
message: definition.message,
|
||||||
default: definition.default,
|
default: definition.default,
|
||||||
|
validate: (values) => {
|
||||||
|
if (!definition.validator) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return definition.validator(Object.values(values).map(({ value }) => value));
|
||||||
|
},
|
||||||
choices: definition.items.map((item) =>
|
choices: definition.items.map((item) =>
|
||||||
typeof item == 'string'
|
typeof item == 'string'
|
||||||
? {
|
? {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user