-
-
Notifications
You must be signed in to change notification settings - Fork 382
Expand file tree
/
Copy pathBootstrapBlazorOptions.cs
More file actions
146 lines (118 loc) · 5.34 KB
/
BootstrapBlazorOptions.cs
File metadata and controls
146 lines (118 loc) · 5.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the Apache 2.0 License
// See the LICENSE file in the project root for more information.
// Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone
using Microsoft.Extensions.Localization;
using System.Globalization;
namespace BootstrapBlazor.Components;
/// <summary>
/// Global configuration class for components
/// </summary>
public class BootstrapBlazorOptions : IOptions<BootstrapBlazorOptions>
{
/// <summary>
/// Gets or sets the default delay for the Toast component, default is 0
/// </summary>
public int ToastDelay { get; set; }
/// <summary>
/// Gets or sets the default delay for the Message component, default is 0
/// </summary>
public int MessageDelay { get; set; }
/// <summary>
/// Gets or sets the default delay for the Swal component, default is 0
/// </summary>
public int SwalDelay { get; set; }
/// <summary>
/// Gets or sets the fallback default language culture, default is "en" (English)
/// </summary>
public string FallbackCulture { get; set; } = "en";
/// <summary>
/// Gets or sets the default position for the Toast component globally, default is null. When set, it overrides the site-wide setting.
/// </summary>
public Placement? ToastPlacement { get; set; }
/// <summary>
/// Gets or sets the list of built-in localization languages for components, default is null
/// </summary>
public List<string>? SupportedCultures { get; set; }
/// <summary>
/// Gets or sets whether to enable global exception capture functionality, default is true
/// </summary>
public bool EnableErrorLogger { get; set; } = true;
/// <summary>
/// Gets or sets whether to fall back to the fallback culture, default is true
/// </summary>
public bool EnableFallbackCulture { get; set; } = true;
/// <summary>
/// Gets or sets whether to ignore missing culture log information, default is null (not set)
/// </summary>
/// <remarks>Uses the default value of <see cref="JsonLocalizationOptions.IgnoreLocalizerMissing"/></remarks>
public bool? IgnoreLocalizerMissing { get; set; }
/// <summary>
/// Gets or sets whether to disable fetching localization resources from the service, default is false (not disabled)
/// </summary>
public bool? DisableGetLocalizerFromService { get; set; }
/// <summary>
/// Gets or sets whether to disable fetching localization resources of type <see cref="ResourceManagerStringLocalizer"/>, default is false (not disabled)
/// </summary>
public bool? DisableGetLocalizerFromResourceManager { get; set; }
/// <summary>
/// Gets or sets the default culture information
/// </summary>
/// <remarks>This parameter is invalid when multi-culture is enabled</remarks>
public string? DefaultCultureInfo { get; set; }
/// <summary>
/// Gets or sets whether to disable the automatic form submission feature by pressing Enter, default is null (not set)
/// </summary>
public bool? DisableAutoSubmitFormByEnter { get; set; }
/// <summary>
/// Gets or sets the JavaScript module script version number, default is null
/// </summary>
public string? JSModuleVersion { get; set; }
/// <summary>
/// Gets or sets the <see cref="TableSettings"/> configuration instance
/// </summary>
public TableSettings TableSettings { get; set; } = new();
/// <summary>
/// Gets or sets the <see cref="ModalSettings"/> configuration instance
/// </summary>
public ModalSettings ModalSettings { get; set; } = new();
/// <summary>
/// Gets or sets the <see cref="StepSettings"/> configuration instance
/// </summary>
public StepSettings StepSettings { get; set; } = new();
/// <summary>
/// Gets or sets the <see cref="ConnectionHubOptions"/> configuration
/// </summary>
public ConnectionHubOptions ConnectionHubOptions { get; set; } = new();
/// <summary>
/// Gets or sets the <see cref="WebClientOptions"/> configuration
/// </summary>
public WebClientOptions WebClientOptions { get; set; } = new();
/// <summary>
/// Gets or sets the <see cref="IpLocatorOptions"/> configuration
/// </summary>
public IpLocatorOptions IpLocatorOptions { get; set; } = new();
/// <summary>
/// Gets or sets the <see cref="ScrollOptions"/> configuration
/// </summary>
public ScrollOptions ScrollOptions { get; set; } = new();
/// <summary>
/// Gets or sets the <see cref="ContextMenuOptions"/> configuration
/// </summary>
public ContextMenuOptions ContextMenuOptions { get; set; } = new();
/// <summary>
/// Gets or sets the CacheManagerOptions configuration
/// </summary>
public CacheManagerOptions CacheManagerOptions { get; set; } = new();
/// <summary>
/// Get or sets website use memorial mode. default is false
/// </summary>
public bool IsMemorialMode { get; set; }
BootstrapBlazorOptions IOptions<BootstrapBlazorOptions>.Value => this;
/// <summary>
/// Gets the collection of supported languages
/// </summary>
/// <returns></returns>
public IList<CultureInfo> GetSupportedCultures() => SupportedCultures?.Select(name => new CultureInfo(name)).ToList()
?? [new("en"), new("zh")];
}