fixes
This commit is contained in:
parent
4ecf486095
commit
17c11becfa
|
|
@ -57,7 +57,7 @@ namespace TIAMSharedUI.Pages.Components
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public string CssClass { get; set; } = "";
|
public string CssClass { get; set; } = "";
|
||||||
|
|
||||||
private ILogger _logger;
|
private LoggerClient<InputWizard> _logger;
|
||||||
|
|
||||||
string _formSubmitResult = "";
|
string _formSubmitResult = "";
|
||||||
private string _spinnerClass = "";
|
private string _spinnerClass = "";
|
||||||
|
|
@ -139,7 +139,7 @@ namespace TIAMSharedUI.Pages.Components
|
||||||
if (!FormSteps.ContainsKey(k))
|
if (!FormSteps.ContainsKey(k))
|
||||||
{
|
{
|
||||||
stepId = Guid.NewGuid();
|
stepId = Guid.NewGuid();
|
||||||
_logger.Detail($"Adding step {k}, {stepId}, for {property.Name}");
|
_logger.DetailConditional($"Adding step {k}, {stepId}, for {property.Name}");
|
||||||
FormSteps.Add(k, stepId);
|
FormSteps.Add(k, stepId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -152,10 +152,10 @@ namespace TIAMSharedUI.Pages.Components
|
||||||
//the following line creates a lambda expression that returns the value of the property
|
//the following line creates a lambda expression that returns the value of the property
|
||||||
var lambda = Expression.Lambda(typeof(Func<>).MakeGenericType(property.PropertyType), access);
|
var lambda = Expression.Lambda(typeof(Func<>).MakeGenericType(property.PropertyType), access);
|
||||||
|
|
||||||
_logger.Detail($"{property.Name}, {property.GetType().FullName}");
|
_logger.DetailConditional($"{property.Name}, {property.GetType().FullName}");
|
||||||
_logger.Detail(lambda.ToString());
|
_logger.DetailConditional(lambda.ToString());
|
||||||
|
|
||||||
_logger.Detail($"lambda: {lambda.ToString()}");
|
_logger.DetailConditional($"lambda: {lambda.ToString()}");
|
||||||
|
|
||||||
layoutItemBuilder.OpenElement(i++, "div");//open div
|
layoutItemBuilder.OpenElement(i++, "div");//open div
|
||||||
layoutItemBuilder.AddAttribute(i++, "id", stepId.ToString());
|
layoutItemBuilder.AddAttribute(i++, "id", stepId.ToString());
|
||||||
|
|
@ -168,7 +168,7 @@ namespace TIAMSharedUI.Pages.Components
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//this input should be focused, so we set a flag
|
//this input should be focused, so we set a flag
|
||||||
_logger.Detail($"Setting focus to {property.Name}");
|
_logger.DetailConditional($"Setting focus to {property.Name}");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -189,7 +189,8 @@ namespace TIAMSharedUI.Pages.Components
|
||||||
case DataType.Text:
|
case DataType.Text:
|
||||||
{
|
{
|
||||||
editor.OpenComponent<DxTextBox>(j++);
|
editor.OpenComponent<DxTextBox>(j++);
|
||||||
_logger.Detail($"{property.Name}, {property.PropertyType}");
|
_logger.DetailConditional($"{property.Name}, {property.PropertyType}");
|
||||||
|
|
||||||
editor.AddAttribute(j++, "Text", property.GetValue(Data));
|
editor.AddAttribute(j++, "Text", property.GetValue(Data));
|
||||||
editor.AddAttribute(j++, "TextExpression", lambda);
|
editor.AddAttribute(j++, "TextExpression", lambda);
|
||||||
editor.AddAttribute(j++, "CssClass", "form-field");
|
editor.AddAttribute(j++, "CssClass", "form-field");
|
||||||
|
|
@ -364,9 +365,9 @@ namespace TIAMSharedUI.Pages.Components
|
||||||
//editor.AddAttribute(j++, "TExpression", lambda);
|
//editor.AddAttribute(j++, "TExpression", lambda);
|
||||||
editor.AddAttribute(j++, "OnSliderChanged", EventCallback.Factory.Create<string>(this, result =>
|
editor.AddAttribute(j++, "OnSliderChanged", EventCallback.Factory.Create<string>(this, result =>
|
||||||
{
|
{
|
||||||
_logger.Detail($"Slider changed to {result}");
|
_logger.DetailConditional($"Slider changed to {result}");
|
||||||
property.SetValue(Data, result);
|
property.SetValue(Data, result);
|
||||||
_logger.Detail($"bleh: {property.Name} = {property.GetValue(Data)}");
|
_logger.DetailConditional($"bleh: {property.Name} = {property.GetValue(Data)}");
|
||||||
//StateHasChanged(); // Add this line to refresh the UI
|
//StateHasChanged(); // Add this line to refresh the UI
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
@ -380,7 +381,7 @@ namespace TIAMSharedUI.Pages.Components
|
||||||
editor.AddAttribute(j++, "TextChanged", EventCallback.Factory.Create<string>(this, str =>
|
editor.AddAttribute(j++, "TextChanged", EventCallback.Factory.Create<string>(this, str =>
|
||||||
{
|
{
|
||||||
property.SetValue(Data, str);
|
property.SetValue(Data, str);
|
||||||
_logger.Detail($"bleh: {property.Name} = {property.GetValue(Data)}");
|
_logger.DetailConditional($"bleh: {property.Name} = {property.GetValue(Data)}");
|
||||||
}));
|
}));
|
||||||
editor.CloseComponent();
|
editor.CloseComponent();
|
||||||
|
|
||||||
|
|
@ -393,7 +394,7 @@ namespace TIAMSharedUI.Pages.Components
|
||||||
editor.AddAttribute(j++, "NullText", "Please tell us your name.");
|
editor.AddAttribute(j++, "NullText", "Please tell us your name.");
|
||||||
editor.AddAttribute(j++, "FirstNameChanged", EventCallback.Factory.Create<string>(this, result =>
|
editor.AddAttribute(j++, "FirstNameChanged", EventCallback.Factory.Create<string>(this, result =>
|
||||||
{
|
{
|
||||||
_logger.Detail($"FirstName changed to {result}");
|
_logger.DetailConditional($"FirstName changed to {result}");
|
||||||
|
|
||||||
//find property with name FirstName
|
//find property with name FirstName
|
||||||
var firstNameProperty = propertyList.FirstOrDefault(p => p.Name == "FirstName");
|
var firstNameProperty = propertyList.FirstOrDefault(p => p.Name == "FirstName");
|
||||||
|
|
@ -412,7 +413,7 @@ namespace TIAMSharedUI.Pages.Components
|
||||||
|
|
||||||
editor.AddAttribute(j++, "LastNameChanged", EventCallback.Factory.Create<string>(this, result =>
|
editor.AddAttribute(j++, "LastNameChanged", EventCallback.Factory.Create<string>(this, result =>
|
||||||
{
|
{
|
||||||
_logger.Detail($"LastName changed to {result}");
|
_logger.DetailConditional($"LastName changed to {result}");
|
||||||
|
|
||||||
//find property with name FirstName
|
//find property with name FirstName
|
||||||
var firstNameProperty = propertyList.FirstOrDefault(p => p.Name == "FirstName");
|
var firstNameProperty = propertyList.FirstOrDefault(p => p.Name == "FirstName");
|
||||||
|
|
@ -427,7 +428,7 @@ namespace TIAMSharedUI.Pages.Components
|
||||||
var fullName = $"{firstName} {lastName}";
|
var fullName = $"{firstName} {lastName}";
|
||||||
property.SetValue(Data, fullName);
|
property.SetValue(Data, fullName);
|
||||||
}
|
}
|
||||||
_logger.Detail($"bleh: {property.Name} = {property.GetValue(Data)}");
|
_logger.DetailConditional($"bleh: {property.Name} = {property.GetValue(Data)}");
|
||||||
StateHasChanged(); // Add this line to refresh the UI
|
StateHasChanged(); // Add this line to refresh the UI
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
@ -441,7 +442,7 @@ namespace TIAMSharedUI.Pages.Components
|
||||||
editor.AddAttribute(j++, "TextChanged", EventCallback.Factory.Create<string>(this, str =>
|
editor.AddAttribute(j++, "TextChanged", EventCallback.Factory.Create<string>(this, str =>
|
||||||
{
|
{
|
||||||
property.SetValue(Data, str);
|
property.SetValue(Data, str);
|
||||||
_logger.Detail($"bleh: {property.Name} = {property.GetValue(Data)}");
|
_logger.DetailConditional($"bleh: {property.Name} = {property.GetValue(Data)}");
|
||||||
}));
|
}));
|
||||||
editor.CloseComponent();
|
editor.CloseComponent();
|
||||||
|
|
||||||
|
|
@ -507,7 +508,7 @@ namespace TIAMSharedUI.Pages.Components
|
||||||
layoutItemBuilder.CloseElement();
|
layoutItemBuilder.CloseElement();
|
||||||
|
|
||||||
|
|
||||||
_logger.Detail($"loop {k}, length: {length}, formSteps: {FormSteps.Count} ");
|
_logger.DetailConditional($"loop {k}, length: {length}, formSteps: {FormSteps.Count} ");
|
||||||
k++;
|
k++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -516,7 +517,7 @@ namespace TIAMSharedUI.Pages.Components
|
||||||
layoutItemBuilder.AddAttribute(i++, "CssClass", "full-width justify-content-center");
|
layoutItemBuilder.AddAttribute(i++, "CssClass", "full-width justify-content-center");
|
||||||
layoutItemBuilder.AddAttribute(i++, "Template", (RenderFragment<object>)((context) => ((editor) =>
|
layoutItemBuilder.AddAttribute(i++, "Template", (RenderFragment<object>)((context) => ((editor) =>
|
||||||
{
|
{
|
||||||
_logger.Detail($"Submit button {CurrentStep}, {FormSteps.Count}");
|
_logger.DetailConditional($"Submit button {CurrentStep}, {FormSteps.Count}");
|
||||||
|
|
||||||
editor.OpenElement(i++, "button");
|
editor.OpenElement(i++, "button");
|
||||||
editor.AddAttribute(i++, "type", "submit");
|
editor.AddAttribute(i++, "type", "submit");
|
||||||
|
|
@ -557,10 +558,10 @@ namespace TIAMSharedUI.Pages.Components
|
||||||
formLayoutBuilder.CloseComponent();
|
formLayoutBuilder.CloseComponent();
|
||||||
};
|
};
|
||||||
|
|
||||||
private void SetPhoneNumber(PropertyInfo property, object Data, string str)
|
private void SetPhoneNumber(PropertyInfo property, object data, string str)
|
||||||
{
|
{
|
||||||
_logger.Info($"SetPhoneNumber called with {str}");
|
_logger.Debug($"SetPhoneNumber called with {str}");
|
||||||
property.SetValue(Data, str);
|
property.SetValue(data, str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -574,9 +575,9 @@ namespace TIAMSharedUI.Pages.Components
|
||||||
MinLength = minLength;
|
MinLength = minLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool IsValid(object value)
|
public override bool IsValid(object? value)
|
||||||
{
|
{
|
||||||
return ((string)value).Length >= MinLength;
|
return value != null && ((string)value).Length >= MinLength;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue