Merge branch 'master' of http://git2.aycode.com/Adam/TourIAm
This commit is contained in:
commit
96cfebdaaf
|
|
@ -57,7 +57,7 @@ namespace TIAMSharedUI.Pages.Components
|
|||
[Parameter]
|
||||
public string CssClass { get; set; } = "";
|
||||
|
||||
private ILogger _logger;
|
||||
private LoggerClient<InputWizard> _logger;
|
||||
|
||||
string _formSubmitResult = "";
|
||||
private string _spinnerClass = "";
|
||||
|
|
@ -139,7 +139,7 @@ namespace TIAMSharedUI.Pages.Components
|
|||
if (!FormSteps.ContainsKey(k))
|
||||
{
|
||||
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);
|
||||
}
|
||||
else
|
||||
|
|
@ -152,10 +152,10 @@ namespace TIAMSharedUI.Pages.Components
|
|||
//the following line creates a lambda expression that returns the value of the property
|
||||
var lambda = Expression.Lambda(typeof(Func<>).MakeGenericType(property.PropertyType), access);
|
||||
|
||||
_logger.Detail($"{property.Name}, {property.GetType().FullName}");
|
||||
_logger.Detail(lambda.ToString());
|
||||
_logger.DetailConditional($"{property.Name}, {property.GetType().FullName}");
|
||||
_logger.DetailConditional(lambda.ToString());
|
||||
|
||||
_logger.Detail($"lambda: {lambda.ToString()}");
|
||||
_logger.DetailConditional($"lambda: {lambda.ToString()}");
|
||||
|
||||
layoutItemBuilder.OpenElement(i++, "div");//open div
|
||||
layoutItemBuilder.AddAttribute(i++, "id", stepId.ToString());
|
||||
|
|
@ -168,7 +168,7 @@ namespace TIAMSharedUI.Pages.Components
|
|||
else
|
||||
{
|
||||
//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:
|
||||
{
|
||||
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++, "TextExpression", lambda);
|
||||
editor.AddAttribute(j++, "CssClass", "form-field");
|
||||
|
|
@ -364,9 +365,9 @@ namespace TIAMSharedUI.Pages.Components
|
|||
//editor.AddAttribute(j++, "TExpression", lambda);
|
||||
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);
|
||||
_logger.Detail($"bleh: {property.Name} = {property.GetValue(Data)}");
|
||||
_logger.DetailConditional($"bleh: {property.Name} = {property.GetValue(Data)}");
|
||||
//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 =>
|
||||
{
|
||||
property.SetValue(Data, str);
|
||||
_logger.Detail($"bleh: {property.Name} = {property.GetValue(Data)}");
|
||||
_logger.DetailConditional($"bleh: {property.Name} = {property.GetValue(Data)}");
|
||||
}));
|
||||
editor.CloseComponent();
|
||||
|
||||
|
|
@ -393,7 +394,7 @@ namespace TIAMSharedUI.Pages.Components
|
|||
editor.AddAttribute(j++, "NullText", "Please tell us your name.");
|
||||
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
|
||||
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 =>
|
||||
{
|
||||
_logger.Detail($"LastName changed to {result}");
|
||||
_logger.DetailConditional($"LastName changed to {result}");
|
||||
|
||||
//find property with name FirstName
|
||||
var firstNameProperty = propertyList.FirstOrDefault(p => p.Name == "FirstName");
|
||||
|
|
@ -427,7 +428,7 @@ namespace TIAMSharedUI.Pages.Components
|
|||
var fullName = $"{firstName} {lastName}";
|
||||
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
|
||||
}));
|
||||
|
||||
|
|
@ -441,7 +442,7 @@ namespace TIAMSharedUI.Pages.Components
|
|||
editor.AddAttribute(j++, "TextChanged", EventCallback.Factory.Create<string>(this, str =>
|
||||
{
|
||||
property.SetValue(Data, str);
|
||||
_logger.Detail($"bleh: {property.Name} = {property.GetValue(Data)}");
|
||||
_logger.DetailConditional($"bleh: {property.Name} = {property.GetValue(Data)}");
|
||||
}));
|
||||
editor.CloseComponent();
|
||||
|
||||
|
|
@ -507,7 +508,7 @@ namespace TIAMSharedUI.Pages.Components
|
|||
layoutItemBuilder.CloseElement();
|
||||
|
||||
|
||||
_logger.Detail($"loop {k}, length: {length}, formSteps: {FormSteps.Count} ");
|
||||
_logger.DetailConditional($"loop {k}, length: {length}, formSteps: {FormSteps.Count} ");
|
||||
k++;
|
||||
|
||||
}
|
||||
|
|
@ -516,7 +517,7 @@ namespace TIAMSharedUI.Pages.Components
|
|||
layoutItemBuilder.AddAttribute(i++, "CssClass", "full-width justify-content-center");
|
||||
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.AddAttribute(i++, "type", "submit");
|
||||
|
|
@ -557,10 +558,10 @@ namespace TIAMSharedUI.Pages.Components
|
|||
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}");
|
||||
property.SetValue(Data, str);
|
||||
_logger.Debug($"SetPhoneNumber called with {str}");
|
||||
property.SetValue(data, str);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -574,9 +575,9 @@ namespace TIAMSharedUI.Pages.Components
|
|||
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