-
Notifications
You must be signed in to change notification settings - Fork 23
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(showcase): add the ngx-form-errors to the showcase #1721
feat(showcase): add the ngx-form-errors to the showcase #1721
Conversation
33e76be
to
4dee132
Compare
4dee132
to
f34f5a8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small changes for the translations.
Also a small issue in the demo page.
It's almost OK 😊
type="password" | ||
[placeholder]="'SHOWCASE.NGX_FORM_ERRORS.FIELDS.CONFIRM_PASSWORD' | translate" | ||
formControlName="confirmPassword" | ||
[errorStateMatcher]="parentErrorStateMatcher" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did some tests locally and I have the feeling this line should not be there. Indeed, if I remove it, I don't have the following issue:
(password fields contain the same values and respect the rules)
Could you please explain why this "parentErrorStateMatcher" is necessary ? 😊
Another point, if the passwords are not equal, the "Submit" button is disabled but no error is displayed 😕
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was a bit lazy in the original implementation and I didn't check properly that it was working as expected.
The reason of the StateMatcher
is to programmatically tell the mat-input
when to toggle to the "error" state because we use a form group validator instead of a control validator, so we must tell the field when there is an error in the group. However our state matcher implementation is indeed buggy.
So I reworked this and the StateMatcher
is not needed anymore 👍 I now use simple control validators and I even use the literal SHOWCASE.NGX_FORM_ERRORS.FORM.VALIDATION.CONFIRM_PASSWORD.ARE_EQUAL
which was not used at all before 😉
Now it works like a charm 💪
f34f5a8
to
33c572a
Compare
Updated the PR with the fixes for the translations and refactored the validation of the "confirmPassword" field. Could you guys have a look? |
3442e87
to
7e8e5b8
Compare
@SuperITMan I've rebased this PR and fixed all conflicts. It's ready to be merged 😉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of thoughts about the translations. 😜
"REQUIRED": "{{fieldName}} is verplicht", | ||
"PASSWORD_REQUIRED": "{{fieldName}} moet worden gegeven", | ||
"USER_NAME": { | ||
"UNIQUE": "Dit gebruikersnaam is al in gebruik" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*Deze gebruikersnaam is al in gebruik
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I think you are not using this translation.
"PASSWORD": { | ||
"MAX_LENGTH": "Wachtwoord mag niet meer dan {{requiredLength}} tekens lang zijn", | ||
"MIN_LENGTH": "Wachtwoord moet minimaal {{requiredLength}} tekens lang zijn", | ||
"PATTERN": "Het wachtwoord moet minimaal één hoofdletter, één kleine letter en één cijfer bevatten" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would keep the sentence structure similar here. Eg: "Wachtwoord moet minimaal één hoofdletter, één kleine letter en één cijfer bevatten"
"PASSWORD": { | ||
"MAX_LENGTH": "Password cannot be more than {{requiredLength}} characters long", | ||
"MIN_LENGTH": "Password must be at least {{requiredLength}} characters long", | ||
"PATTERN": "The password must contain at least one uppercase, one lowercase, and one number" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would keep the sentence structure similar here. Eg: "Password must contain at least one uppercase, one lowercase, and one number"
Hey guys, fyi I'll continue with this PR in the next days so it can finally be merged 😉 (god! it's been open for a year now!!) |
a839e85
to
b119bc4
Compare
b119bc4
to
4a98d3c
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Finally the day has come! PR rebased and updated with the latest remarks! 👍 Can you guys have a look? |
LGTM! Thanks for your great job on this! 👍 |
ISSUES CLOSED: #1195
Supersedes: #1361
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: Incomplete PR #1361
What is the new behavior?
Took over the same changes from #1361 and made the necessary fixes based on the pending remarks:
ngx-form-errors
Does this PR introduce a breaking change?