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

feat(config): support global config option for default validation trigger #536

Merged

Conversation

RomkeVdMeulen
Copy link
Contributor

Fixes #535.

I moved AureliaValidationConfiguration to a separate file and added a method defaultValidationTrigger that users can call to globally configure the default validation trigger like so:

aurelia.use
  .plugin("aurelia-validation", (config: AureliaValidationConfiguration) => {
    config.defaultValidationTrigger(validateTrigger.manual);
  });

I wasn't sure how to get the configured trigger into the ValidationController so I simply opted to register the config instance and inject it.

I considered making AureliaValidationConfiguration.getDefaultValidationTrigger() private to present a cleaner interface to users, but decided against it since this way the call in the ValidationController constructor can be type-checked.

@RomkeVdMeulen
Copy link
Contributor Author

What do you think @bigopon?

src/validation-controller.ts Outdated Show resolved Hide resolved
test/validation-controller-factory.ts Show resolved Hide resolved
src/config.ts Outdated Show resolved Hide resolved
@bigopon
Copy link
Member

bigopon commented Oct 31, 2019

@RomkeVdMeulen Big oops, i completely forgot about this, sorry. I left a couple of comments, other than that, It's looking good. Will do 2nd round of review soon

@RomkeVdMeulen
Copy link
Contributor Author

@bigopon I've renamed the config class. Any other changes you'd like?

src/config.ts Show resolved Hide resolved
@RomkeVdMeulen
Copy link
Contributor Author

@bigopon Anything else?

@bigopon
Copy link
Member

bigopon commented Nov 22, 2019

@RomkeVdMeulen let's go i guess 👍
cc @EisenbergEffect @fkleuver

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.

Configure default validation trigger
4 participants