-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New controls for mobile devices with labels inset
- Loading branch information
1 parent
1dc33c2
commit 5dbced9
Showing
32 changed files
with
1,271 additions
and
4 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
25 changes: 25 additions & 0 deletions
25
src/Headway.Blazor.Controls/Components/Mobile/Checkbox.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,25 @@ | ||
@using Headway.Core.Dynamic | ||
@using Headway.Core.Model | ||
@using Microsoft.AspNetCore.Components.Forms | ||
@using System.Reflection | ||
@using System.Linq.Expressions | ||
|
||
@inherits CheckboxBase | ||
|
||
<div class="mb-1"> | ||
<div class="row"> | ||
<div class="col-sm-4"> | ||
@if(string.IsNullOrWhiteSpace(Field.Tooltip)) | ||
{ | ||
<MudCheckBox T="bool" @bind-Checked="PropertyValue" Label="@Field.Label" /> | ||
} | ||
else | ||
{ | ||
<MudTooltip Text="@Field.Tooltip" Placement="Placement.Top"> | ||
<MudCheckBox T="bool" @bind-Checked="PropertyValue" Label="@Field.Label" /> | ||
</MudTooltip> | ||
} | ||
</div> | ||
<div class="col-sm-8"></div> | ||
</div> | ||
</div> |
21 changes: 21 additions & 0 deletions
21
src/Headway.Blazor.Controls/Components/Mobile/Checkbox.razor.cs
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,21 @@ | ||
using Headway.Core.Attributes; | ||
using Headway.Blazor.Controls.Base; | ||
|
||
namespace Headway.Blazor.Controls.Components.Mobile | ||
{ | ||
[DynamicComponent] | ||
public abstract class CheckboxBase : DynamicComponentBase | ||
{ | ||
public bool PropertyValue | ||
{ | ||
get | ||
{ | ||
return (bool)Field.PropertyInfo.GetValue(Field.Model); | ||
} | ||
set | ||
{ | ||
Field.PropertyInfo.SetValue(Field.Model, value); | ||
} | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/Headway.Blazor.Controls/Components/Mobile/CheckboxNullable.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,25 @@ | ||
@using Headway.Core.Dynamic | ||
@using Headway.Core.Model | ||
@using Microsoft.AspNetCore.Components.Forms | ||
@using System.Reflection | ||
@using System.Linq.Expressions | ||
|
||
@inherits CheckboxNullableBase | ||
|
||
<div class="mb-1"> | ||
<div class="row"> | ||
<div class="col-sm-4"> | ||
@if(string.IsNullOrWhiteSpace(Field.Tooltip)) | ||
{ | ||
<MudCheckBox T="bool?" @bind-Checked="PropertyValue" Label="@Field.Label" /> | ||
} | ||
else | ||
{ | ||
<MudTooltip Text="@Field.Tooltip" Placement="Placement.Top"> | ||
<MudCheckBox T="bool?" @bind-Checked="PropertyValue" Label="@Field.Label" /> | ||
</MudTooltip> | ||
} | ||
</div> | ||
<div class="col-sm-8"></div> | ||
</div> | ||
</div> |
21 changes: 21 additions & 0 deletions
21
src/Headway.Blazor.Controls/Components/Mobile/CheckboxNullable.razor.cs
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,21 @@ | ||
using Headway.Core.Attributes; | ||
using Headway.Blazor.Controls.Base; | ||
|
||
namespace Headway.Blazor.Controls.Components.Mobile | ||
{ | ||
[DynamicComponent] | ||
public abstract class CheckboxNullableBase : DynamicComponentBase | ||
{ | ||
public bool? PropertyValue | ||
{ | ||
get | ||
{ | ||
return (bool?)Field.PropertyInfo.GetValue(Field.Model); | ||
} | ||
set | ||
{ | ||
Field.PropertyInfo.SetValue(Field.Model, value); | ||
} | ||
} | ||
} | ||
} |
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,27 @@ | ||
@using Headway.Core.Dynamic | ||
@using Headway.Core.Model | ||
@using Microsoft.AspNetCore.Components.Forms | ||
@using System.Reflection | ||
@using System.Linq.Expressions | ||
|
||
@inherits DateBase | ||
|
||
<div class="mb-1"> | ||
<div class="row"> | ||
<div class="col-sm-4"> | ||
@if(string.IsNullOrWhiteSpace(Field.Tooltip)) | ||
{ | ||
<MudTextField T="DateTime" @bind-Value="@PropertyValue" For="FieldExpression" Format="yyyy-MM-dd" | ||
Variant="Variant.Outlined" InputType="InputType.Date" Label="@Field.Label" /> | ||
} | ||
else | ||
{ | ||
<MudTooltip Text="@Field.Tooltip" Placement="Placement.Top"> | ||
<MudTextField T="DateTime" @bind-Value="@PropertyValue" For="FieldExpression" Format="yyyy-MM-dd" | ||
Variant="Variant.Outlined" InputType="InputType.Date" Label="@Field.Label" /> | ||
</MudTooltip> | ||
} | ||
</div> | ||
<div class="col-sm-8" /> | ||
</div> | ||
</div> |
32 changes: 32 additions & 0 deletions
32
src/Headway.Blazor.Controls/Components/Mobile/Date.razor.cs
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,32 @@ | ||
using Headway.Core.Attributes; | ||
using Headway.Blazor.Controls.Base; | ||
using Microsoft.AspNetCore.Components; | ||
using System; | ||
using System.Linq.Expressions; | ||
|
||
namespace Headway.Blazor.Controls.Components.Mobile | ||
{ | ||
[DynamicComponent] | ||
public abstract class DateBase : DynamicComponentBase | ||
{ | ||
public Expression<Func<DateTime>> FieldExpression | ||
{ | ||
get | ||
{ | ||
return Expression.Lambda<Func<DateTime>>(Field.MemberExpression); | ||
} | ||
} | ||
|
||
public DateTime PropertyValue | ||
{ | ||
get | ||
{ | ||
return (DateTime)Field.PropertyInfo.GetValue(Field.Model); | ||
} | ||
set | ||
{ | ||
Field.PropertyInfo.SetValue(Field.Model, value); | ||
} | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/Headway.Blazor.Controls/Components/Mobile/DateNullable.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,27 @@ | ||
@using Headway.Core.Dynamic | ||
@using Headway.Core.Model | ||
@using Microsoft.AspNetCore.Components.Forms | ||
@using System.Reflection | ||
@using System.Linq.Expressions | ||
|
||
@inherits DateNullableBase | ||
|
||
<div class="mb-1"> | ||
<div class="row"> | ||
<div class="col-sm-4"> | ||
@if(string.IsNullOrWhiteSpace(Field.Tooltip)) | ||
{ | ||
<MudTextField T="DateTime?" @bind-Value="@PropertyValue" For="FieldExpression" Format="yyyy-MM-dd" | ||
Variant="Variant.Outlined" InputType="InputType.Date" Label="@Field.Label" /> | ||
} | ||
else | ||
{ | ||
<MudTooltip Text="@Field.Tooltip" Placement="Placement.Top"> | ||
<MudTextField T="DateTime?" @bind-Value="@PropertyValue" For="FieldExpression" Format="yyyy-MM-dd" | ||
Variant="Variant.Outlined" InputType="InputType.Date" Label="@Field.Label" /> | ||
</MudTooltip> | ||
} | ||
</div> | ||
<div class="col-sm-8" /> | ||
</div> | ||
</div> |
32 changes: 32 additions & 0 deletions
32
src/Headway.Blazor.Controls/Components/Mobile/DateNullable.razor.cs
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,32 @@ | ||
using Headway.Core.Attributes; | ||
using Headway.Blazor.Controls.Base; | ||
using Microsoft.AspNetCore.Components; | ||
using System; | ||
using System.Linq.Expressions; | ||
|
||
namespace Headway.Blazor.Controls.Components.Mobile | ||
{ | ||
[DynamicComponent] | ||
public abstract class DateNullableBase : DynamicComponentBase | ||
{ | ||
public Expression<Func<DateTime?>> FieldExpression | ||
{ | ||
get | ||
{ | ||
return Expression.Lambda<Func<DateTime?>>(Field.MemberExpression); | ||
} | ||
} | ||
|
||
public DateTime? PropertyValue | ||
{ | ||
get | ||
{ | ||
return (DateTime?)Field.PropertyInfo.GetValue(Field.Model); | ||
} | ||
set | ||
{ | ||
Field.PropertyInfo.SetValue(Field.Model, value); | ||
} | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/Headway.Blazor.Controls/Components/Mobile/Decimal.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,27 @@ | ||
@using Headway.Core.Dynamic | ||
@using Headway.Core.Model | ||
@using Microsoft.AspNetCore.Components.Forms | ||
@using System.Reflection | ||
@using System.Linq.Expressions | ||
|
||
@inherits DecimalBase | ||
|
||
<div class="mb-1"> | ||
<div class="row"> | ||
<div class="col-sm-4"> | ||
@if(string.IsNullOrWhiteSpace(Field.Tooltip)) | ||
{ | ||
<MudNumericField @bind-Value="@PropertyValue" MaxLength="@MaxLength" Min="@Min" Max="@Max" | ||
For="FieldExpression" Variant="Variant.Outlined" Label="@Field.Label" /> | ||
} | ||
else | ||
{ | ||
<ComponentTip Text="@Field.Tooltip"> | ||
<MudNumericField @bind-Value="@PropertyValue" MaxLength="@MaxLength" Min="@Min" Max="@Max" | ||
For="FieldExpression" Variant="Variant.Outlined" Label="@Field.Label" /> | ||
</ComponentTip> | ||
} | ||
</div> | ||
<div class="col-sm-8" /> | ||
</div> | ||
</div> |
77 changes: 77 additions & 0 deletions
77
src/Headway.Blazor.Controls/Components/Mobile/Decimal.razor.cs
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,77 @@ | ||
using Headway.Core.Attributes; | ||
using Headway.Core.Constants; | ||
using Headway.Core.Helpers; | ||
using Headway.Blazor.Controls.Base; | ||
using Microsoft.AspNetCore.Components; | ||
using System; | ||
using System.Linq.Expressions; | ||
using System.Threading.Tasks; | ||
|
||
namespace Headway.Blazor.Controls.Components.Mobile | ||
{ | ||
[DynamicComponent] | ||
public abstract class DecimalBase : DynamicComponentBase | ||
{ | ||
protected string format = string.Empty; | ||
protected int? maxLength = null; | ||
protected decimal? min = null; | ||
protected decimal? max = null; | ||
|
||
protected override Task OnInitializedAsync() | ||
{ | ||
var formatArg = ComponentArgHelper.GetArg(ComponentArgs, Args.FORMAT); | ||
|
||
if (formatArg != null) | ||
{ | ||
format = formatArg.Value; | ||
} | ||
|
||
var maxLengthArg = ComponentArgHelper.GetArg(ComponentArgs, Args.MAX_LENGTH); | ||
|
||
if (maxLengthArg != null) | ||
{ | ||
maxLength = int.Parse(maxLengthArg.Value); | ||
} | ||
|
||
var minArg = ComponentArgHelper.GetArg(ComponentArgs, Args.MIN); | ||
|
||
if (minArg != null) | ||
{ | ||
min = decimal.Parse(minArg.Value); | ||
} | ||
|
||
var maxArg = ComponentArgHelper.GetArg(ComponentArgs, Args.MAX); | ||
|
||
if (maxArg != null) | ||
{ | ||
max = decimal.Parse(maxArg.Value); | ||
} | ||
|
||
return base.OnInitializedAsync(); | ||
} | ||
|
||
public int MaxLength { get { return maxLength.HasValue ? maxLength.Value : int.MaxValue; } } | ||
public decimal Max { get { return max ?? decimal.MaxValue; } } | ||
public decimal Min { get { return min ?? decimal.MinValue; } } | ||
|
||
public Expression<Func<decimal>> FieldExpression | ||
{ | ||
get | ||
{ | ||
return Expression.Lambda<Func<decimal>>(Field.MemberExpression); | ||
} | ||
} | ||
|
||
public decimal PropertyValue | ||
{ | ||
get | ||
{ | ||
return (decimal)Field.PropertyInfo.GetValue(Field.Model); | ||
} | ||
set | ||
{ | ||
Field.PropertyInfo.SetValue(Field.Model, value); | ||
} | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/Headway.Blazor.Controls/Components/Mobile/DecimalNullable.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,27 @@ | ||
@using Headway.Core.Dynamic | ||
@using Headway.Core.Model | ||
@using Microsoft.AspNetCore.Components.Forms | ||
@using System.Reflection | ||
@using System.Linq.Expressions | ||
|
||
@inherits DecimalNullableBase | ||
|
||
<div class="mb-1"> | ||
<div class="row"> | ||
<div class="col-sm-4"> | ||
@if(string.IsNullOrWhiteSpace(Field.Tooltip)) | ||
{ | ||
<MudNumericField @bind-Value="@PropertyValue" Format="@format" MaxLength="@MaxLength" Min="@Min" Max="@Max" | ||
For="FieldExpression" Variant="Variant.Outlined" Label="@Field.Label" /> | ||
} | ||
else | ||
{ | ||
<ComponentTip Text="@Field.Tooltip"> | ||
<MudNumericField @bind-Value="@PropertyValue" Format="@format" MaxLength="@MaxLength" Min="@Min" Max="@Max" | ||
For="FieldExpression" Variant="Variant.Outlined" Label="@Field.Label" /> | ||
</ComponentTip> | ||
} | ||
</div> | ||
<div class="col-sm-8" /> | ||
</div> | ||
</div> |
Oops, something went wrong.