mirror of https://github.com/abpframework/abp.git
33 changed files with 275 additions and 103970 deletions
@ -0,0 +1,32 @@ |
|||||
|
@typeparam TEntity |
||||
|
@typeparam TResourceType |
||||
|
@using Volo.Abp.Localization |
||||
|
@using Volo.Abp.ObjectExtending |
||||
|
@inherits MudExtensionPropertyComponentBase<TEntity, TResourceType> |
||||
|
|
||||
|
@if (PropertyInfo != null && Entity != null) |
||||
|
{ |
||||
|
@if (PropertyInfo.IsDate()) |
||||
|
{ |
||||
|
<MudDatePicker T="DateTime?" |
||||
|
Label="@PropertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)" |
||||
|
@bind-Date="@DateOnlyValue" |
||||
|
Disabled="IsReadonlyField" |
||||
|
Validation="@((Func<DateTime?, string?>)(v => Validate(v)))" |
||||
|
DateFormat="@GetDateFormat()" /> |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
<MudStack Row="true" Spacing="2"> |
||||
|
<MudDatePicker T="DateTime?" |
||||
|
Label="@PropertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)" |
||||
|
@bind-Date="@DateValue" |
||||
|
Disabled="IsReadonlyField" |
||||
|
DateFormat="@GetDateFormat()" /> |
||||
|
<MudTimePicker T="TimeSpan?" |
||||
|
Label="@GetTimeLabel()" |
||||
|
@bind-Time="@TimeValue" |
||||
|
Disabled="IsReadonlyField" /> |
||||
|
</MudStack> |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,93 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp.Data; |
||||
|
using Volo.Abp.ObjectExtending; |
||||
|
|
||||
|
namespace Volo.Abp.MudBlazorUI.Components.ObjectExtending; |
||||
|
|
||||
|
public partial class MudDateTimeOffsetExtensionProperty<TEntity, TResourceType> |
||||
|
where TEntity : IHasExtraProperties |
||||
|
{ |
||||
|
protected DateTimeOffset? Value |
||||
|
{ |
||||
|
get |
||||
|
{ |
||||
|
var raw = Entity.GetProperty(PropertyInfo.Name); |
||||
|
return raw switch |
||||
|
{ |
||||
|
null => null, |
||||
|
DateTimeOffset dto => dto, |
||||
|
DateTime dt => dt.Kind switch |
||||
|
{ |
||||
|
DateTimeKind.Utc => new DateTimeOffset(dt, TimeSpan.Zero), |
||||
|
DateTimeKind.Local => new DateTimeOffset(dt), |
||||
|
_ => new DateTimeOffset(DateTime.SpecifyKind(dt, DateTimeKind.Utc), TimeSpan.Zero) |
||||
|
}, |
||||
|
_ => null |
||||
|
}; |
||||
|
} |
||||
|
set => Entity.SetProperty(PropertyInfo.Name, value, false); |
||||
|
} |
||||
|
|
||||
|
protected DateTime? DateOnlyValue |
||||
|
{ |
||||
|
get => Value?.DateTime.Date; |
||||
|
set |
||||
|
{ |
||||
|
if (value.HasValue) |
||||
|
{ |
||||
|
Value = new DateTimeOffset(value.Value); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
Value = null; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
protected DateTime? DateValue |
||||
|
{ |
||||
|
get => Value?.DateTime.Date; |
||||
|
set |
||||
|
{ |
||||
|
if (value.HasValue) |
||||
|
{ |
||||
|
var time = Value?.DateTime.TimeOfDay ?? TimeSpan.Zero; |
||||
|
var offset = Value?.Offset ?? TimeSpan.Zero; |
||||
|
Value = new DateTimeOffset(value.Value.Date + time, offset); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
Value = null; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
protected TimeSpan? TimeValue |
||||
|
{ |
||||
|
get => Value?.DateTime.TimeOfDay; |
||||
|
set |
||||
|
{ |
||||
|
if (Value.HasValue && value.HasValue) |
||||
|
{ |
||||
|
var offset = Value.Value.Offset; |
||||
|
Value = new DateTimeOffset(Value.Value.DateTime.Date + value.Value, offset); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
protected string GetDateFormat() |
||||
|
{ |
||||
|
var dataFormatString = PropertyInfo.GetDataFormatStringOrNull(); |
||||
|
if (!string.IsNullOrEmpty(dataFormatString)) |
||||
|
{ |
||||
|
return dataFormatString.Replace("{0:", "").Replace("}", ""); |
||||
|
} |
||||
|
|
||||
|
return PropertyInfo.IsDate() ? "yyyy-MM-dd" : "yyyy-MM-dd"; |
||||
|
} |
||||
|
|
||||
|
protected string GetTimeLabel() |
||||
|
{ |
||||
|
return "Time"; |
||||
|
} |
||||
|
} |
||||
@ -1,10 +1,9 @@ |
|||||
namespace Volo.Abp.Identity.Blazor.MudBlazor; |
namespace Volo.Abp.Identity.Blazor.MudBlazor; |
||||
|
|
||||
public static class IdentityMenuNames |
public class IdentityMenuNames |
||||
{ |
{ |
||||
public const string GroupName = "IdentityManagement"; |
public const string GroupName = "AbpIdentity"; |
||||
|
|
||||
public const string Roles = "AbpIdentity.Roles"; |
public const string Roles = GroupName + ".Roles"; |
||||
|
public const string Users = GroupName + ".Users"; |
||||
public const string Users = "AbpIdentity.Users"; |
|
||||
} |
} |
||||
|
|||||
File diff suppressed because it is too large
Loading…
Reference in new issue