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
Masking: Add DateMask and support Mask in DatePicker #3874
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #3874 +/- ##
==========================================
+ Coverage 91.04% 91.12% +0.07%
==========================================
Files 350 351 +1
Lines 11462 11603 +141
==========================================
+ Hits 10436 10573 +137
- Misses 1026 1030 +4
Continue to review full report at Codecov.
|
mask.CaretPos = 4; | ||
mask.ToString().Should().Be("12/3|1/99"); | ||
mask.Delete(); | ||
mask.ToString().Should().Be("12/3|1/9"); |
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'm not sure about the following use case:
- Write
12/3|1/99
- I wanted to type
12/30/99
so I press delete - Now I have
12/3|1/9
so I press 0. - But the year is now
12/30|/19
Maybe the mask should autocorrect on blur?
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.
The same happens here: https://nosir.github.io/cleave.js/ in the date example, but I agree that this is not exactly desirable behavior.
Some of the autocorrection while typing is pretty useful though. like typing 5599 results in 05/05/99.
So maybe this kind of autocorrection should be applied only when typing at the end of the text?
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.
@henon Autocorrection is very cool and time saving.
What about theses rules?
- When typing, autocorrect if the preceding date part is completed or constrained.
- When pressing delete or backspace, don't autocorrect.
- When the mask is fully filled, autocorrect the whole date.
Scenarios :
- With a mask
MM/dd/yyyy
- When pressing 5, autocorrect to 05.
- Press 4, autocorrect to 04
- Press 2018
- With a mask
MM/dd/yy
- Enter 10420 gives 10/04/20
- Move cursor 10/0|4/20
- Press delete
- Press backspace
- Type 12
- It gives 10/12/20
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.
@naster01 I agree and I plan to do this in a followup PR.
This should close #3892 |
* DateMask * Fixed mask examples for small screens * Add datemask example to docs * MudPicker: support Masking * Docs: DatePicker masking examples
* DateMask * Fixed mask examples for small screens * Add datemask example to docs * MudPicker: support Masking * Docs: DatePicker masking examples
* DateMask * Fixed mask examples for small screens * Add datemask example to docs * MudPicker: support Masking * Docs: DatePicker masking examples
* DateMask * Fixed mask examples for small screens * Add datemask example to docs * MudPicker: support Masking * Docs: DatePicker masking examples
* DateMask * Fixed mask examples for small screens * Add datemask example to docs * MudPicker: support Masking * Docs: DatePicker masking examples
* DateMask * Fixed mask examples for small screens * Add datemask example to docs * MudPicker: support Masking * Docs: DatePicker masking examples
* DateMask * Fixed mask examples for small screens * Add datemask example to docs * MudPicker: support Masking * Docs: DatePicker masking examples
closes #3892
Adds a date mask algorithm that works exactly like Cleave.js's date mask.
How Has This Been Tested?
unit
Types of changes
Checklist:
dev
).