update
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
@using RobotApp.Common.Shares.Dtos
|
||||
|
||||
<EditForm Model="@Local" OnValidSubmit="OnSubmit">
|
||||
<DataAnnotationsValidator />
|
||||
<ValidationSummary />
|
||||
<div class="form-check mb-2">
|
||||
<InputCheckbox class="form-check-input" @bind-Value="Local.EnableSimulation" />
|
||||
<label class="form-check-label">Enable Simulation</label>
|
||||
</div>
|
||||
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Max Velocity (m/s)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.SimulationMaxVelocity" />
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Max Angular Velocity (rad/s)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.SimulationMaxAngularVelocity" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Acceleration (m/s²)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.SimulationAcceleration" />
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Deceleration (m/s²)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.SimulationDeceleration" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-2">
|
||||
<label class="form-label">Description</label>
|
||||
<InputTextArea class="form-control" @bind-Value="Local.Description" />
|
||||
</div>
|
||||
</EditForm>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public RobotSimulationConfigDto Model { get; set; } = new();
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<RobotSimulationConfigDto> ModelChanged { get; set; }
|
||||
|
||||
private RobotSimulationConfigDto Local = new();
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
// Use record 'with' to create a shallow copy so parent isn't mutated until submit
|
||||
Local = Model is not null ? Model with { } : new RobotSimulationConfigDto();
|
||||
}
|
||||
|
||||
private async Task OnSubmit()
|
||||
{
|
||||
Model = Local;
|
||||
await ModelChanged.InvokeAsync(Model);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user