|
7 | 7 | <MudInputControl Label="@Label" Variant="@Variant" HelperText="@HelperText" HelperTextOnFocus="@HelperTextOnFocus" FullWidth="@FullWidth" Margin="@Margin" Class="@Classname" Style="@Style" |
8 | 8 | Error="@Error" ErrorText="@ErrorText" ErrorId="@ErrorId" Disabled="@Disabled" @onclick="@(Editable ? null : ToggleMenu)" Required="@Required" ForId="@FieldId"> |
9 | 9 | <InputContent> |
10 | | - <MudInput |
11 | | - @ref="InputReference" Margin="@Margin" Placeholder="@Placeholder" |
| 10 | + <MudInput @ref="InputReference" Margin="@Margin" Placeholder="@Placeholder" |
12 | 11 | Variant="@Variant" InputType="InputType.Text" |
13 | 12 | TextUpdateSuppression="false" |
14 | 13 | Value="@(Text)" DisableUnderLine="@DisableUnderLine" |
|
33 | 32 | } |
34 | 33 | </div> |
35 | 34 | } |
36 | | - |
| 35 | + |
37 | 36 | <div class="d-flex"> |
38 | 37 | @if (DateView == DateView.Date || DateView == DateView.Both) |
39 | 38 | { |
40 | | - int yearIndex = DateFormat.IndexOf('y'); |
41 | | - int monthIndex = DateFormat.IndexOf('M'); |
42 | | - int dayIndex = DateFormat.IndexOf('d'); |
43 | | - @if (yearIndex < dayIndex) |
44 | | - { |
45 | | - <MudWheel Class="mud-width-full" @bind-Value="_year" ItemCollection="Years" Sensitivity="@Sensitivity" Label="@(ShowHeader ? LocalizedStrings.Year : null)" Dense="@Dense" Color="@Color" Disabled="FixYear" /> |
46 | | - <MudWheel Class="mud-width-full" Value="_month" ValueChanged=@((int m) => OnMonthChanged(m)) ItemCollection="Months" Sensitivity="@Sensitivity" Label="@(ShowHeader ? LocalizedStrings.Month : null)" ToStringFunc="new Func<int, string>(NumberToString)" Dense="@Dense" Color="@Color" Disabled="FixMonth" /> |
47 | | - <MudWheel Class="mud-width-full" @bind-Value="_day" ItemCollection="Days" Sensitivity="@Sensitivity" Label="@(ShowHeader ? LocalizedStrings.Day : null)" ToStringFunc="new Func<int, string>(NumberToString)" Dense="@Dense" Color="@Color" Disabled="FixDay" /> |
48 | | - } |
49 | | - else if (monthIndex < dayIndex && dayIndex < yearIndex ) |
50 | | - { |
51 | | - <MudWheel Class="mud-width-full" Value="_month" ValueChanged=@((int m) => OnMonthChanged(m)) ItemCollection="Months" Sensitivity="@Sensitivity" Label="@(ShowHeader ? LocalizedStrings.Month : null)" ToStringFunc="new Func<int, string>(NumberToString)" Dense="@Dense" Color="@Color" Disabled="FixMonth" /> |
52 | | - <MudWheel Class="mud-width-full" @bind-Value="_day" ItemCollection="Days" Sensitivity="@Sensitivity" Label="@(ShowHeader ? LocalizedStrings.Day : null)" ToStringFunc="new Func<int, string>(NumberToString)" Dense="@Dense" Color="@Color" Disabled="FixDay" /> |
53 | | - <MudWheel Class="mud-width-full" @bind-Value="_year" ItemCollection="Years" Sensitivity="@Sensitivity" Label="@(ShowHeader ? LocalizedStrings.Year : null)" Dense="@Dense" Color="@Color" Disabled="FixYear" /> |
54 | | - } |
55 | | - else |
| 39 | + string dateFormat = new string(DateFormat); |
| 40 | + |
| 41 | + while (dateFormat.Length > 0) |
56 | 42 | { |
57 | | - <MudWheel Class="mud-width-full" @bind-Value="_day" ItemCollection="Days" Sensitivity="@Sensitivity" Label="@(ShowHeader ? LocalizedStrings.Day : null)" ToStringFunc="new Func<int, string>(NumberToString)" Dense="@Dense" Color="@Color" Disabled="FixDay" /> |
58 | | - <MudWheel Class="mud-width-full" Value="_month" ValueChanged=@((int m) => OnMonthChanged(m)) ItemCollection="Months" Sensitivity="@Sensitivity" Label="@(ShowHeader ? LocalizedStrings.Month : null)" ToStringFunc="new Func<int, string>(NumberToString)" Dense="@Dense" Color="@Color" Disabled="FixMonth" /> |
59 | | - <MudWheel Class="mud-width-full" @bind-Value="_year" ItemCollection="Years" Sensitivity="@Sensitivity" Label="@(ShowHeader ? LocalizedStrings.Year : null)" Dense="@Dense" Color="@Color" Disabled="FixYear" /> |
| 43 | + switch (dateFormat[0]) |
| 44 | + { |
| 45 | + case 'd': |
| 46 | + <MudWheel Class="mud-width-full" @bind-Value="_day" ItemCollection="Days" Sensitivity="@Sensitivity" Label="@(ShowHeader ? LocalizedStrings.Day : null)" ToStringFunc="new Func<int, string>(NumberToString)" Dense="@Dense" Color="@Color" Disabled="FixDay" /> |
| 47 | + break; |
| 48 | + case 'M': |
| 49 | + <MudWheel Class="mud-width-full" Value="_month" ValueChanged=@((int m) => OnMonthChanged(m)) ItemCollection="Months" Sensitivity="@Sensitivity" Label="@(ShowHeader ? LocalizedStrings.Month : null)" ToStringFunc="new Func<int, string>(NumberToString)" Dense="@Dense" Color="@Color" Disabled="FixMonth" /> |
| 50 | + break; |
| 51 | + case 'y': |
| 52 | + <MudWheel Class="mud-width-full" @bind-Value="_year" ItemCollection="Years" Sensitivity="@Sensitivity" Label="@(ShowHeader ? LocalizedStrings.Year : null)" Dense="@Dense" Color="@Color" Disabled="FixYear" /> |
| 53 | + break; |
| 54 | + } |
| 55 | + |
| 56 | + dateFormat = dateFormat.Replace(dateFormat[0].ToString(), string.Empty); |
60 | 57 | } |
61 | 58 | } |
62 | 59 | @if (DateView == DateView.Time || DateView == DateView.Both) |
|
0 commit comments