ngx-formly icon indicating copy to clipboard operation
ngx-formly copied to clipboard

feat(core): add showValid configuration extra

Open MaxKless opened this issue 3 years ago • 3 comments

THIS IS A DRAFT PR

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...) This is a feature to add a centrally configurable showValid extra that types and wrappers can read to configure their validation display behavior.

What is the current behavior? (You can also link to an open issue here) Currently, it is possible to configure when to show errors using showError. This is sometimes too limited as explained in #2728.

What is the new behavior (if this is a feature change)? Now, an additional function (showValid) is available to separately control when to show valid feedback (positive validation) messages and styling. This is not used throughout formly itself but e.g. bootstraps supports it and it is very useful to have a configurable analogue in the module

@aitboudad this is what I had in mind, it's a pretty small change in the core functionality. The custom type in the provided example is adjusted to show what I mean. Of course, this is a draft PR so if you still think this is a useful feature (even though it doesn't address your concerns about #2385 ) I will proceed and flesh it out with tests and see how to fix the change detection in the example. I'm also willing to work on a more general solution and probably more complex solution for more fine-grained control over validation. In that case just reject this PR and we can discuss how to proceed.

Please check if the PR fulfills these requirements

  • [ ] The commit messages follow our guidelines: https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#commit-message-format
  • [ ] A unit test has been written for this change.
  • [ ] Running npm run build produced a successful build. (Unit testing can be done by running npm test;)
  • [ ] My code has been linted. (npm run lint to do this. npm run build will fail if there are files not linted.)

Please provide a screenshot of this feature before and after your code changes, if applicable.

Other information:

MaxKless avatar Feb 07 '22 10:02 MaxKless

Deploy Preview for formly-dev failed.

Name Link
Latest commit b0d60d2f7a5b9882ce4f151a00e29980f5183842
Latest deploy log https://app.netlify.com/sites/formly-dev/deploys/62e12d65665f820008bca26f

netlify[bot] avatar Feb 07 '22 10:02 netlify[bot]

Thanks for the PR :+1:, I may see if we can unify the current approach with some related issues else we can go that way!

aitboudad avatar Feb 10 '22 10:02 aitboudad

Okay great, let me know how I can help :) I'm ready to do some actual coding in here!

MaxKless avatar Feb 10 '22 12:02 MaxKless