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: add option to show errors always on change #71

Merged
merged 4 commits into from
May 24, 2022
Merged

feat: add option to show errors always on change #71

merged 4 commits into from
May 24, 2022

Conversation

kfrederix
Copy link
Contributor

@kfrederix kfrederix commented May 23, 2022

#62

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines: CONTRIBUTING.md#commit
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Errors are shown after blur (+ after that on change). There is an option to disable showing the errors on blur: in that case they will only be shown on submit of the form. There is no option to always show/hide the errors on every change.

Issue Number: #62

What is the new behavior?

Default behavior stays the same. Pre-existing options also remain the same.
A new option was added: controlErrorsOnChange. This will be false by default. When set to true, it will show/hide the errors always on change.

Additionally, a global configuration option was added which makes it possible to override the default values for controlErrorsOnAsync, controlErrorsOnBlur and controlErrorsOnChange.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

@@ -24,6 +24,11 @@ export type ErrorTailorConfig = {
blurPredicate?: (element: Element) => boolean;
controlErrorComponent?: Type<ControlErrorComponent>;
controlErrorComponentAnchorFn?: (hostElement: Element, errorElement: Element) => () => void;
controlErrorsOn?: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change to:

{
  controlErrorsOn: {
     async: boolean;
     blur: boolean;
     change: boolean;
  }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated. I kept them optional, is that ok?

Copy link
Member

@NetanelBasal NetanelBasal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Please update the docs.

@kfrederix
Copy link
Contributor Author

LGTM. Please update the docs.

Docs are also updated now.

@NetanelBasal NetanelBasal merged commit 5892c75 into ngneat:master May 24, 2022
@kfrederix
Copy link
Contributor Author

Thank you for merging so quickly! Could you publish a new version to npm?

@NetanelBasal
Copy link
Member

Done

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.

None yet

2 participants