Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Masking: Add DateMask and support Mask in DatePicker (#3874)
* DateMask * Fixed mask examples for small screens * Add datemask example to docs * MudPicker: support Masking * Docs: DatePicker masking examples
- Loading branch information
Showing
16 changed files
with
703 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/MudBlazor.Docs/Pages/Components/DatePicker/Examples/DatePickerMaskExample.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@namespace MudBlazor.Docs.Examples | ||
|
||
<MudDatePicker Label="dd.MM.yyyy" Editable="true" @bind-Date="date1" Mask="@(new DateMask("dd.MM.yyyy"))" DateFormat="dd.MM.yyyy" Placeholder="de-AT Date" /> | ||
<MudDatePicker Label="MM/dd/yyyy" Editable="true" @bind-Date="date2" Mask="@(new DateMask("MM/dd/yyyy"))" DateFormat="MM/dd/yyyy" Placeholder="en-US Date" /> | ||
<MudDatePicker Label="yyyy-MM-dd" Editable="true" @bind-Date="date3" Mask="@(new DateMask("0000-00-00"))" DateFormat="yyyy-MM-dd" Placeholder="ISO Date" /> | ||
|
||
@code { | ||
DateTime? date1 = null; | ||
DateTime? date2 = DateTime.Today; | ||
DateTime? date3 = null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/MudBlazor.Docs/Pages/Features/Masking/Examples/DateMaskExample.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
@using System.Globalization | ||
@namespace MudBlazor.Docs.Examples | ||
|
||
|
||
<MudGrid Class="justify-space-between" Style="max-width: 800px;"> | ||
<MudItem xs="12" sm="6"> | ||
<MudTextField Mask="@mask1" Label="ISO Date" HelperText="@mask1.Mask" | ||
@bind-Value="isoDate" Variant="@Variant.Text" Clearable /> | ||
ISO: <b>@isoDate</b> | ||
</MudItem> | ||
<MudItem xs="12" sm="6"> | ||
<MudTextField Mask="@mask2" Label="US" HelperText="@mask2.Mask" | ||
@bind-Value="usDate" Variant="@Variant.Text" Clearable /> | ||
US: <b>@usDate</b> | ||
</MudItem> | ||
<MudItem xs="12" sm="6"> | ||
<MudTextField Mask="@mask3" Label="AT" HelperText="@mask3.Mask" | ||
@bind-Value="atDate" Variant="@Variant.Text" Clearable /> | ||
AT: <b>@atDate</b> | ||
</MudItem> | ||
<MudItem xs="12" sm="6"> | ||
<MudTextField Mask="@mask4" Label="Month" HelperText="@mask4.Mask" | ||
@bind-Value="monthAndYear" Variant="@Variant.Text" Clearable /> | ||
MM/YY: <b>@monthAndYear</b> | ||
</MudItem> | ||
</MudGrid> | ||
|
||
@code { | ||
string isoDate, usDate, atDate; | ||
string monthAndYear; | ||
|
||
IMask mask1 = new DateMask("yyyy-MM-dd"); | ||
IMask mask2 = new DateMask("MM/dd/yyyy"); | ||
IMask mask3 = new DateMask("TT.MM.JJJJ", 'J', 'M', 'T'); | ||
IMask mask4 = new DateMask("MM/YY", 'Y', 'M'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.