Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
@typeparam T
@namespace AXSharp.Presentation.Blazor.Controls.Templates
@using System.Globalization;
@inherits TemplateBaseOnline<T>
@namespace AXSharp.Presentation.Blazor.Controls.Templates

@typeparam T

<TemplateView Symbol="@OnlinerSymbol" FailureReason="@Onliner.AccessStatus.FailureReason">

<label for="@ComponentId">@Onliner.AttributeName</label>
<input id="@ComponentId"
readonly="@IsReadOnly"
class="w-100 form-control @AccessStatus"
type=@IsNumeric(typeof(T))
step=any
@onfocus="@( () => {HasFocus = true; LastValue = Onliner.LastValue;} )"
@onblur="@( () => HasFocus = false )"
@bind="Value" />

type="@IsNumeric(typeof(T))"
step="any"
@bind="Value"
@onfocus="@(() => { HasFocus = true; LastValue = Onliner.LastValue; })"
@onblur="@(() => HasFocus = false)">
</TemplateView>


@code{

@code {
private string IsNumeric(Type type)
{
if (type == null) return "text";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
@inherits TemplateBaseOnline<bool>

<TemplateView Symbol="@OnlinerSymbol" FailureReason="@Onliner.AccessStatus.FailureReason">
<label for="@ComponentId" >@Onliner.AttributeName</label>
<label for="@ComponentId">@Onliner.AttributeName</label>
<div class="form-check form-switch">
<input id="@ComponentId"
disabled="@IsReadOnly"
class="form-check-input @AccessStatus"
type="checkbox"
@bind="Value">

</div>
</TemplateView>
Original file line number Diff line number Diff line change
@@ -1,13 +1,38 @@
@namespace AXSharp.Presentation.Blazor.Controls.Templates
@using System.Globalization;
@inherits TemplateBaseOnline<DateOnly>

<TemplateView Symbol="@OnlinerSymbol" FailureReason="@Onliner.AccessStatus.FailureReason">

<label for="@ComponentId" >@Onliner.AttributeName</label>
<label for="@ComponentId">@Onliner.AttributeName</label>
<input id="@ComponentId"
readonly="@IsReadOnly"
class="w-100 form-control @AccessStatus"
type="date"
@bind="Value" />

</TemplateView>
readonly="@IsReadOnly"
class="w-100 form-control @AccessStatus"
type="date"
value="@Value.ToString("yyyy-MM-dd")"
@onfocus="@(() => { HasFocus = true; LastValue = Onliner.LastValue; })"
@onblur="@(() => HasFocus = false)"
@onfocusout="FocusOut"
@onchange="Change"
@key="Key">
</TemplateView>

@code
{
private DateOnly InputValue { get; set; }
private int Key = 0;

private void FocusOut(FocusEventArgs args)
{
if (InputValue != new DateOnly())
Value = InputValue;
InputValue = new DateOnly();

Key++;
}

private void Change(ChangeEventArgs args)
{
if (DateOnly.TryParse(args.Value.ToString(), CultureInfo.InvariantCulture, DateTimeStyles.None, out var parseValue))
InputValue = parseValue;
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,39 @@
@namespace AXSharp.Presentation.Blazor.Controls.Templates
@using System.Globalization;
@inherits TemplateBaseOnline<DateTime>

<TemplateView Symbol="@OnlinerSymbol" FailureReason="@Onliner.AccessStatus.FailureReason">

<label for="@ComponentId" >@Onliner.AttributeName</label>
<label for="@ComponentId">@Onliner.AttributeName</label>
<input id="@ComponentId"
readonly="@IsReadOnly"
class="w-100 form-control @AccessStatus"
type="datetime-local"
step=1
name="onlineDateTime"
@bind="Value">

</TemplateView>
readonly="@IsReadOnly"
class="w-100 form-control @AccessStatus"
type="datetime-local"
step="1"
value="@Value.ToString("yyyy-MM-dd\"T\"HH:mm:ss")"
@onfocus="@(() => { HasFocus = true; LastValue = Onliner.LastValue; })"
@onblur="@(() => HasFocus = false)"
@onfocusout="FocusOut"
@onchange="Change"
@key="Key">
</TemplateView>

@code
{
private DateTime InputValue { get; set; }
private int Key = 0;

private void FocusOut(FocusEventArgs args)
{
if (InputValue != new DateTime())
Value = InputValue;
InputValue = new DateTime();

Key++;
}

private void Change(ChangeEventArgs args)
{
if (DateTime.TryParse(args.Value.ToString(), CultureInfo.InvariantCulture, DateTimeStyles.None, out var parseValue))
InputValue = parseValue;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@namespace AXSharp.Presentation.Blazor.Controls.Templates
@inherits TemplateBaseOnline<DateTime>

<OnlinerDateTimeControlView Onliner="Onliner" IsReadOnly="IsReadOnly" PollingInterval="PollingInterval" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@namespace AXSharp.Presentation.Blazor.Controls.Templates
@using System.Globalization;
@inherits TemplateBaseOnline<Double>

<TemplateView Symbol="@OnlinerSymbol" FailureReason="@Onliner.AccessStatus.FailureReason">
<label for="@ComponentId">@Onliner.AttributeName</label>
<input id="@ComponentId"
readonly="@IsReadOnly"
class="w-100 form-control @AccessStatus"
type="number"
step="any"
value="@Value.ToString().Replace(',', '.')"
@onfocus="@(() => { HasFocus = true; LastValue = Onliner.LastValue; })"
@onblur="@(() => HasFocus = false)"
@onchange="Change"
@key="Key">
</TemplateView>

@code {
private int Key = 0;

private void Change(ChangeEventArgs args)
{
if (Double.TryParse(args.Value.ToString().Replace('.', ','), out var parseValue))
Value = parseValue;

Key++;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@namespace AXSharp.Presentation.Blazor.Controls.Templates
@inherits TemplateBaseOnline<TimeSpan>

<OnlinerTimeControlView Onliner="Onliner" IsReadOnly="IsReadOnly" PollingInterval="PollingInterval" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@namespace AXSharp.Presentation.Blazor.Controls.Templates
@inherits TemplateBaseOnline<TimeSpan>

<OnlinerTimeOfDayControlView Onliner="Onliner" IsReadOnly="IsReadOnly" PollingInterval="PollingInterval" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@namespace AXSharp.Presentation.Blazor.Controls.Templates
@using System.Globalization;
@inherits TemplateBaseOnline<Single>

<TemplateView Symbol="@OnlinerSymbol" FailureReason="@Onliner.AccessStatus.FailureReason">
<label for="@ComponentId">@Onliner.AttributeName</label>
<input id="@ComponentId"
readonly="@IsReadOnly"
class="w-100 form-control @AccessStatus"
type="number"
step="any"
value="@Value.ToString().Replace(',', '.')"
@onfocus="@(() => { HasFocus = true; LastValue = Onliner.LastValue; })"
@onblur="@(() => HasFocus = false)"
@onchange="Change"
@key="Key">
</TemplateView>

@code {
private int Key = 0;

private void Change(ChangeEventArgs args)
{
if (Single.TryParse(args.Value.ToString().Replace('.', ','), out var parseValue))
Value = parseValue;

Key++;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@namespace AXSharp.Presentation.Blazor.Controls.Templates
@using System.Globalization;
@using System.Text.RegularExpressions;
@inherits TemplateBaseOnline<TimeSpan>

<TemplateView Symbol="@OnlinerSymbol" FailureReason="@Onliner.AccessStatus.FailureReason">
<label for="@ComponentId">@Onliner.AttributeName</label>
<input id="@ComponentId"
readonly="@IsReadOnly"
class="w-100 form-control @AccessStatus"
type="text"
value="@Value.ToString(Onliner.AttributeFormatString ?? "c", CultureInfo.InvariantCulture)"
@onfocus="@(() => { HasFocus = true; LastValue = Onliner.LastValue; })"
@onblur="@(() => HasFocus = false)"
@onchange="Change"
@key="Key">
</TemplateView>

@code
{
private int Key = 0;

private void Change(ChangeEventArgs args)
{
if (TimeSpan.TryParseExact(args.Value.ToString(), Onliner.AttributeFormatString ?? "c", CultureInfo.InvariantCulture, out var parseValue))
Value = parseValue;

Key++;
}
}
Original file line number Diff line number Diff line change
@@ -1,33 +1,39 @@
@namespace AXSharp.Presentation.Blazor.Controls.Templates
@using System.Globalization;
@inherits TemplateBaseOnline<TimeSpan>

<TemplateView Symbol="@OnlinerSymbol" FailureReason="@Onliner.AccessStatus.FailureReason">

<label for="@ComponentId" >@Onliner.AttributeName</label>
<label for="@ComponentId">@Onliner.AttributeName</label>
<input id="@ComponentId"
readonly="@IsReadOnly"
class="w-100 form-control @AccessStatus"
type="time"
step="1"
name="onlineTime"
value="@Onliner.Cyclic"
@onchange="ValueChanged">

readonly="@IsReadOnly"
class="w-100 form-control @AccessStatus"
type="time"
step="1"
value="@Value.ToString(@"hh\:mm\:ss", CultureInfo.InvariantCulture)"
@onfocus="@(() => { HasFocus = true; LastValue = Onliner.LastValue; })"
@onblur="@(() => HasFocus = false)"
@onfocusout="FocusOut"
@onchange="Change"
@key="Key">
</TemplateView>

@code
{
private void ValueChanged(ChangeEventArgs args)
private TimeSpan InputValue { get; set; }
private int Key = 0;

private void FocusOut(FocusEventArgs args)
{
try
{
var parsedTimeSpan = TimeSpan.Parse(args.Value.ToString());
Onliner.Edit = parsedTimeSpan;
if (InputValue != new TimeSpan())
Value = InputValue;
InputValue = new TimeSpan();

}
catch
{
//do nothing
}
Key++;
}

private void Change(ChangeEventArgs args)
{
if (TimeSpan.TryParse(args.Value.ToString(), CultureInfo.InvariantCulture, out var parseValue))
InputValue = parseValue;
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
@namespace AXSharp.Presentation.Blazor.Controls.Templates
@typeparam T
@inherits TemplateBaseOnline<T>
<TemplateView Symbol="@OnlinerSymbol" FailureReason="@Onliner.AccessStatus.FailureReason">

<label for="@(ComponentId)" >@Onliner.AttributeName</label>
<input id="@(ComponentId)"
readonly="readonly"
class="w-100 form-control @AccessStatus"
style=@(IsReadOnly? "" : "background-color:transparent")
type="text"
step=any
value=@Onliner.Cyclic />
@typeparam T

<TemplateView Symbol="@OnlinerSymbol" FailureReason="@Onliner.AccessStatus.FailureReason">
<label for="@ComponentId">@Onliner.AttributeName</label>
<input id="@ComponentId"
readonly="readonly"
class="w-100 form-control @AccessStatus"
style="@(IsReadOnly? "" : "background-color:transparent")"
type="text"
step="any"
value="@Onliner.Cyclic">
</TemplateView>
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
@inherits TemplateBaseOnline<bool>

<TemplateView Symbol="@OnlinerSymbol" FailureReason="@Onliner.AccessStatus.FailureReason">

<label for="@(ComponentId)" >@Onliner.AttributeName</label>
<label for="@ComponentId">@Onliner.AttributeName</label>
<div class="form-check form-switch">
<input id="@(ComponentId)"
<input id="@ComponentId"
disabled
class="form-check-input @AccessStatus"
type="checkbox"
@bind="Onliner.Cyclic"
disabled>
@bind="Onliner.Cyclic">
</div>

</TemplateView>
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
@inherits TemplateBaseOnline<DateOnly>

<TemplateView Symbol="@OnlinerSymbol" FailureReason="@Onliner.AccessStatus.FailureReason">

<label for="@(ComponentId)" >@Onliner.AttributeName</label>
<input id="@(ComponentId)"
readonly="readonly"
class="w-100 form-control @AccessStatus"
style=@(IsReadOnly? "" : "background-color:transparent")
type="date"
value=@Onliner.Cyclic />

<label for="@ComponentId">@Onliner.AttributeName</label>
<input id="@ComponentId"
readonly="readonly"
class="w-100 form-control @AccessStatus"
style="@(IsReadOnly? "" : "background-color:transparent")"
type="text"
value="@Onliner.Cyclic">
</TemplateView>
Loading