Skip to content

Commit 74d35c3

Browse files
committed
Upgrading to dotnet 10
1 parent fbf67f1 commit 74d35c3

File tree

105 files changed

+3925
-4282
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+3925
-4282
lines changed
Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,32 @@
11

2-
namespace Orbyss.Blazor.JsonForms.ComponentInstances
2+
namespace Orbyss.Blazor.JsonForms.ComponentInstances;
3+
4+
public class ButtonFormComponentInstance : ButtonFormComponentInstanceBase
35
{
4-
public class ButtonFormComponentInstance : ButtonFormComponentInstanceBase
6+
public ButtonFormComponentInstance(Type componentType, IDictionary<string, string> textTranslations)
7+
: base(textTranslations)
58
{
6-
public ButtonFormComponentInstance(Type componentType, IDictionary<string, string> textTranslations)
7-
: base(textTranslations)
8-
{
9-
ComponentType = componentType;
10-
}
11-
12-
public ButtonFormComponentInstance(Type componentType, string text)
13-
: base(text)
14-
{
15-
ComponentType = componentType;
16-
}
9+
ComponentType = componentType;
10+
}
1711

18-
public override sealed Type ComponentType { get; }
12+
public ButtonFormComponentInstance(Type componentType, string text)
13+
: base(text)
14+
{
15+
ComponentType = componentType;
1916
}
2017

21-
public class ButtonFormComponentInstance<TComponent> : ButtonFormComponentInstance
18+
public override sealed Type ComponentType { get; }
19+
}
20+
21+
public class ButtonFormComponentInstance<TComponent> : ButtonFormComponentInstance
22+
{
23+
public ButtonFormComponentInstance(IDictionary<string, string> textTranslations)
24+
: base(typeof(TComponent), textTranslations)
2225
{
23-
public ButtonFormComponentInstance(IDictionary<string, string> textTranslations)
24-
: base(typeof(TComponent), textTranslations)
25-
{
26-
}
26+
}
2727

28-
public ButtonFormComponentInstance(string text)
29-
: base(typeof(TComponent), text)
30-
{
31-
}
28+
public ButtonFormComponentInstance(string text)
29+
: base(typeof(TComponent), text)
30+
{
3231
}
3332
}
Lines changed: 44 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,66 @@
11
using Microsoft.AspNetCore.Components;
22
using System.Collections.ObjectModel;
33

4-
namespace Orbyss.Blazor.JsonForms.ComponentInstances
4+
namespace Orbyss.Blazor.JsonForms.ComponentInstances;
5+
6+
public abstract class ButtonFormComponentInstanceBase : FormComponentInstanceBase
57
{
6-
public abstract class ButtonFormComponentInstanceBase : FormComponentInstanceBase
7-
{
8-
private readonly ReadOnlyDictionary<string, string>? translations;
9-
private readonly string? text;
8+
private readonly ReadOnlyDictionary<string, string>? translations;
9+
private readonly string? text;
1010

11-
protected ButtonFormComponentInstanceBase(IDictionary<string, string> textTranslations)
12-
{
13-
var dictionary = new Dictionary<string, string>(textTranslations, StringComparer.OrdinalIgnoreCase);
14-
translations = new ReadOnlyDictionary<string, string>(dictionary);
15-
}
11+
protected ButtonFormComponentInstanceBase(IDictionary<string, string> textTranslations)
12+
{
13+
var dictionary = new Dictionary<string, string>(textTranslations, StringComparer.OrdinalIgnoreCase);
14+
translations = new ReadOnlyDictionary<string, string>(dictionary);
15+
}
1616

17-
protected ButtonFormComponentInstanceBase(string text)
18-
{
19-
this.text = text;
20-
}
17+
protected ButtonFormComponentInstanceBase(string text)
18+
{
19+
this.text = text;
20+
}
2121

22-
internal string? Language { get; set; }
22+
internal string? Language { get; set; }
2323

24-
public EventCallback? OnClicked { get; internal set; }
24+
public EventCallback? OnClicked { get; internal set; }
2525

26-
public bool Disabled { get; set; }
26+
public bool Disabled { get; set; }
2727

28-
public string? Text
28+
public string? Text
29+
{
30+
get
2931
{
30-
get
32+
if (!string.IsNullOrWhiteSpace(text))
3133
{
32-
if (!string.IsNullOrWhiteSpace(text))
33-
{
34-
return text;
35-
}
36-
37-
if (string.IsNullOrWhiteSpace(Language))
38-
{
39-
return translations?.FirstOrDefault().Value;
40-
}
34+
return text;
35+
}
4136

42-
if (translations?.ContainsKey(Language) == true)
43-
{
44-
return translations[Language];
45-
}
37+
if (string.IsNullOrWhiteSpace(Language))
38+
{
39+
return translations?.FirstOrDefault().Value;
40+
}
4641

47-
return null;
42+
if (translations?.ContainsKey(Language) == true)
43+
{
44+
return translations[Language];
4845
}
49-
}
5046

51-
protected virtual IDictionary<string, object?> GetButtonParameters()
52-
{
53-
return new Dictionary<string, object?>();
47+
return null;
5448
}
49+
}
5550

56-
protected override sealed IDictionary<string, object?> GetParametersCore()
57-
{
58-
var result = GetButtonParameters();
51+
protected virtual IDictionary<string, object?> GetButtonParameters()
52+
{
53+
return new Dictionary<string, object?>();
54+
}
5955

60-
result[nameof(Text)] = Text;
61-
result[nameof(Disabled)] = Disabled;
62-
result[nameof(OnClicked)] = OnClicked;
56+
protected override sealed IDictionary<string, object?> GetParametersCore()
57+
{
58+
var result = GetButtonParameters();
6359

64-
return result;
65-
}
60+
result[nameof(Text)] = Text;
61+
result[nameof(Disabled)] = Disabled;
62+
result[nameof(OnClicked)] = OnClicked;
63+
64+
return result;
6665
}
6766
}
Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
11
using Newtonsoft.Json.Linq;
2-
using System;
3-
using System.Collections.Generic;
4-
using System.Linq;
5-
using System.Text;
6-
using System.Threading.Tasks;
72

8-
namespace Orbyss.Blazor.JsonForms.ComponentInstances
3+
namespace Orbyss.Blazor.JsonForms.ComponentInstances;
4+
5+
public class DateOnlyInputFormComponentInstance(Type componentGenericTypeDefinition) : DateOnlyInputFormComponentInstanceBase<DateOnly?>
96
{
10-
public class DateOnlyInputFormComponentInstance(Type componentGenericTypeDefinition) : DateOnlyInputFormComponentInstanceBase<DateOnly?>
11-
{
12-
public override Type ComponentType => componentGenericTypeDefinition.MakeGenericType(typeof(DateOnly?));
7+
public override Type ComponentType => componentGenericTypeDefinition.MakeGenericType(typeof(DateOnly?));
138

14-
protected override sealed Func<DateTime?, DateOnly?>? ConvertFromDateTime => dt => dt.HasValue ? new DateOnly(dt.Value.Year, dt.Value.Month, dt.Value.Day) : null;
9+
protected override sealed Func<DateTime?, DateOnly?>? ConvertFromDateTime => dt => dt.HasValue ? new DateOnly(dt.Value.Year, dt.Value.Month, dt.Value.Day) : null;
1510

16-
protected override sealed Func<DateOnly?, DateTime?>? ConvertToDateTime => dt => dt.HasValue ? dt.Value.ToDateTime(TimeOnly.MinValue) : null;
11+
protected override sealed Func<DateOnly?, DateTime?>? ConvertToDateTime => dt => dt.HasValue ? dt.Value.ToDateTime(TimeOnly.MinValue) : null;
1712

18-
protected override sealed object? ConvertValue(JToken? token)
19-
{
20-
return DateOnly.TryParse($"{token}", Culture, out var date)
21-
? date
22-
: null;
23-
}
13+
protected override sealed object? ConvertValue(JToken? token)
14+
{
15+
return DateOnly.TryParse($"{token}", Culture, out var date)
16+
? date
17+
: null;
2418
}
2519
}
Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,32 @@
1-
namespace Orbyss.Blazor.JsonForms.ComponentInstances
1+
namespace Orbyss.Blazor.JsonForms.ComponentInstances;
2+
3+
public abstract class DateOnlyInputFormComponentInstanceBase<TDate> : InputFormComponentInstanceBase
24
{
3-
public abstract class DateOnlyInputFormComponentInstanceBase<TDate> : InputFormComponentInstanceBase
4-
{
5-
protected abstract Func<DateTime?, TDate>? ConvertFromDateTime { get; }
5+
protected abstract Func<DateTime?, TDate>? ConvertFromDateTime { get; }
66

7-
protected abstract Func<TDate, DateTime?>? ConvertToDateTime { get; }
7+
protected abstract Func<TDate, DateTime?>? ConvertToDateTime { get; }
88

9-
public DateTime? MinimumDate { get; set; }
9+
public DateTime? MinimumDate { get; set; }
1010

11-
public DateTime? MaximumDate { get; set; }
11+
public DateTime? MaximumDate { get; set; }
1212

13-
public bool AllowManualInput { get; set; }
13+
public bool AllowManualInput { get; set; }
1414

15-
protected override sealed IDictionary<string, object?> GetFormInputParameters()
16-
{
17-
var result = GetDateInputParameter();
15+
protected override sealed IDictionary<string, object?> GetFormInputParameters()
16+
{
17+
var result = GetDateInputParameter();
1818

19-
result[nameof(ConvertFromDateTime)] = ConvertFromDateTime;
20-
result[nameof(ConvertToDateTime)] = ConvertToDateTime;
21-
result[nameof(MinimumDate)] = MinimumDate;
22-
result[nameof(MaximumDate)] = MaximumDate;
23-
result[nameof(AllowManualInput)] = AllowManualInput;
19+
result[nameof(ConvertFromDateTime)] = ConvertFromDateTime;
20+
result[nameof(ConvertToDateTime)] = ConvertToDateTime;
21+
result[nameof(MinimumDate)] = MinimumDate;
22+
result[nameof(MaximumDate)] = MaximumDate;
23+
result[nameof(AllowManualInput)] = AllowManualInput;
2424

25-
return result;
26-
}
25+
return result;
26+
}
2727

28-
protected virtual IDictionary<string, object?> GetDateInputParameter()
29-
{
30-
return new Dictionary<string, object?>();
31-
}
28+
protected virtual IDictionary<string, object?> GetDateInputParameter()
29+
{
30+
return new Dictionary<string, object?>();
3231
}
3332
}
Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
using Newtonsoft.Json.Linq;
22
using Orbyss.Components.Json.Models;
33

4-
namespace Orbyss.Blazor.JsonForms.ComponentInstances
4+
namespace Orbyss.Blazor.JsonForms.ComponentInstances;
5+
6+
public class DateOnlyUtcTicksInputFormComponentInstance(Type componentGenericTypeDefinition) : DateOnlyInputFormComponentInstanceBase<DateUtcTicks?>
57
{
6-
public class DateOnlyUtcTicksInputFormComponentInstance(Type componentGenericTypeDefinition) : DateOnlyInputFormComponentInstanceBase<DateUtcTicks?>
7-
{
8-
public override Type ComponentType => componentGenericTypeDefinition.MakeGenericType(typeof(DateUtcTicks?));
8+
public override Type ComponentType => componentGenericTypeDefinition.MakeGenericType(typeof(DateUtcTicks?));
99

10-
protected override sealed Func<DateTime?, DateUtcTicks?>? ConvertFromDateTime => dt => dt.HasValue ? new DateUtcTicks(dt.Value.Ticks) : null;
10+
protected override sealed Func<DateTime?, DateUtcTicks?>? ConvertFromDateTime => dt => dt.HasValue ? new DateUtcTicks(dt.Value.Ticks) : null;
1111

12-
protected override sealed Func<DateUtcTicks?, DateTime?>? ConvertToDateTime => dt => dt.HasValue ? dt.Value.DateOnly.ToDateTime(TimeOnly.MinValue) : null;
12+
protected override sealed Func<DateUtcTicks?, DateTime?>? ConvertToDateTime => dt => dt.HasValue ? dt.Value.DateOnly.ToDateTime(TimeOnly.MinValue) : null;
1313

14-
protected override sealed object? ConvertValue(JToken? token)
14+
protected override sealed object? ConvertValue(JToken? token)
15+
{
16+
if (token is null || string.IsNullOrWhiteSpace($"{token}"))
1517
{
16-
if (token is null || string.IsNullOrWhiteSpace($"{token}"))
17-
{
18-
return null;
19-
}
20-
21-
return new DateUtcTicks((long)token);
18+
return null;
2219
}
20+
21+
return new DateUtcTicks((long)token);
2322
}
2423
}
Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
using Newtonsoft.Json.Linq;
22

3-
namespace Orbyss.Blazor.JsonForms.ComponentInstances
3+
namespace Orbyss.Blazor.JsonForms.ComponentInstances;
4+
5+
public class DateTimeInputFormComponentInstance(Type componentGenericTypeDefinition) : DateTimeInputFormComponentInstanceBase<DateTime?>
46
{
5-
public class DateTimeInputFormComponentInstance(Type componentGenericTypeDefinition) : DateTimeInputFormComponentInstanceBase<DateTime?>
6-
{
7-
public override Type ComponentType => componentGenericTypeDefinition.MakeGenericType(typeof(DateTime?));
7+
public override Type ComponentType => componentGenericTypeDefinition.MakeGenericType(typeof(DateTime?));
88

9-
protected override sealed Func<DateTime?, DateTime?>? ConvertFromDateTime => (dt) => dt;
9+
protected override sealed Func<DateTime?, DateTime?>? ConvertFromDateTime => (dt) => dt;
1010

11-
protected override sealed Func<DateTime?, DateTime?>? ConvertToDateTime => (dt) => dt;
11+
protected override sealed Func<DateTime?, DateTime?>? ConvertToDateTime => (dt) => dt;
1212

13-
protected override sealed object? ConvertValue(JToken? token)
14-
{
15-
return DateTime.TryParse($"{token}", Culture, out var dateTime)
16-
? dateTime
17-
: null;
18-
}
19-
}
13+
protected override sealed object? ConvertValue(JToken? token)
14+
{
15+
return DateTime.TryParse($"{token}", Culture, out var dateTime)
16+
? dateTime
17+
: null;
18+
}
2019
}
Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,26 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
1+
namespace Orbyss.Blazor.JsonForms.ComponentInstances;
62

7-
namespace Orbyss.Blazor.JsonForms.ComponentInstances
3+
public abstract class DateTimeInputFormComponentInstanceBase<TDate> : DateOnlyInputFormComponentInstanceBase<TDate>
84
{
9-
public abstract class DateTimeInputFormComponentInstanceBase<TDate> : DateOnlyInputFormComponentInstanceBase<TDate>
10-
{
11-
public DateTime? MinimumTime { get; set; }
5+
public DateTime? MinimumTime { get; set; }
126

13-
public DateTime? MaximumTime { get; set; }
7+
public DateTime? MaximumTime { get; set; }
148

15-
public int? TimeStep { get; set; }
9+
public int? TimeStep { get; set; }
1610

17-
protected sealed override IDictionary<string, object?> GetDateInputParameter()
18-
{
19-
var result = GetDateTimeInputParameter();
11+
protected sealed override IDictionary<string, object?> GetDateInputParameter()
12+
{
13+
var result = GetDateTimeInputParameter();
2014

21-
result[nameof(MinimumTime)] = MinimumTime;
22-
result[nameof(MaximumTime)] = MaximumTime;
23-
result[nameof(TimeStep)] = TimeStep;
15+
result[nameof(MinimumTime)] = MinimumTime;
16+
result[nameof(MaximumTime)] = MaximumTime;
17+
result[nameof(TimeStep)] = TimeStep;
2418

25-
return result;
26-
}
19+
return result;
20+
}
2721

28-
protected virtual IDictionary<string, object?> GetDateTimeInputParameter()
29-
{
30-
return new Dictionary<string, object?>();
31-
}
22+
protected virtual IDictionary<string, object?> GetDateTimeInputParameter()
23+
{
24+
return new Dictionary<string, object?>();
3225
}
3326
}

0 commit comments

Comments
 (0)