aurelia / validation

A validation plugin for Aurelia.
MIT License
132 stars 128 forks source link

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

Closed RomkeVdMeulen closed 4 years ago

RomkeVdMeulen commented 5 years ago

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 commented 5 years ago

What do you think @bigopon?

bigopon commented 5 years ago

@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 commented 4 years ago

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

RomkeVdMeulen commented 4 years ago

@bigopon Anything else?

bigopon commented 4 years ago

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