Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/BootstrapBlazor.Server/Components/Pages/GlobalOption.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@page "/global-option"
@page "/global-option"
@inject IStringLocalizer<GlobalOption> Localizer

<h3>@Localizer["Title"]</h3>
Expand Down Expand Up @@ -65,6 +65,21 @@
<li><code>TableExportOptions.ArrayDelimiter</code> 数组类型合并操作时使用的分隔符</li>
</ul>

<p class="code-label"><code>DateTimeSettings</code> 日期时间全局配置</p>

<p>@((MarkupString)Localizer["DateTimeSettingsIntro"].Value)</p>

<ul class="demo-ul">
<li>@((MarkupString)Localizer["DateTimeSettingsParseDateTimeCallback"].Value)</li>
<li>@((MarkupString)Localizer["DateTimeSettingsParseDateTimeOffsetCallback"].Value)</li>
</ul>

<Pre>builder.Services.AddBootstrapBlazor(options =&gt;
{
options.DateTimeSettings.ParseDateTimeCallback = value =&gt; DateTime.ParseExact(value, "yyyyMMdd", CultureInfo.InvariantCulture);
options.DateTimeSettings.ParseDateTimeOffsetCallback = value =&gt; DateTimeOffset.ParseExact(value, "yyyyMMdd zzz", CultureInfo.InvariantCulture);
});</Pre>

<p class="code-label"><code>StepSettings</code> 步长全局统一配置各种数据类型的步长值</p>

<p class="code-label"><code>ConnectionHubOptions</code> 步长全局统一配置各种数据类型的步长值</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,13 @@
</DemoBlock>

<DemoBlock Title="@Localizer["IsEditableTitle"]" Introduction="@Localizer["IsEditableIntro"]" Name="IsEditable">
<section ignore class="mb-3">
<Tips>@((MarkupString)Localizer["IsEditableTip"].Value)</Tips>
<p>@((MarkupString)Localizer["IsEditableCallbackTip"].Value)</p>
</section>
<div class="row g-3">
<div class="col-sm-6">
<DateTimePicker @bind-Value="@BindValue" IsEditable="true" DateFormat="yyyy-MM-dd" />
<DateTimePicker @bind-Value="@BindValue" IsEditable="true" DateFormat="yyyy-MM-dd" ParseDateTimeCallback="ParseDateTime" />
</div>
</div>
</DemoBlock>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// See the LICENSE file in the project root for more information.
// Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone

using System.Globalization;

namespace BootstrapBlazor.Server.Components.Samples;

/// <summary>
Expand Down Expand Up @@ -73,6 +75,8 @@ private static string FormatterSpanString(TimeSpan ts)

private DateTime? BindValue { get; set; } = DateTime.Today;

private static DateTime ParseDateTime(string value) => DateTime.ParseExact(value, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture);

private string BindValueString
{
get => BindValue.HasValue ? BindValue.Value.ToString("yyyy-MM-dd") : "";
Expand Down
119 changes: 62 additions & 57 deletions src/BootstrapBlazor.Server/Locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,12 @@
"BarcodeReader": "BarcodeReader",
"Block": "Block",
"Bluetooth": "IBluetooth",
"BootstrapBlazorIcon": "Icon",
"BootstrapIcon": "Bootstrap Icons",
"BootstrapInput": "BootstrapInput",
"BootstrapInputGroup": "BootstrapInputGroup",
"BootstrapInputNumber": "BootstrapInputNumber",
"BootstrapLabel": "Labels",
"Breadcrumb": "Breadcrumb",
"Breakpoints": "Breakpoints",
"BrowserFinger": "BrowserFingerService",
Expand Down Expand Up @@ -278,23 +283,18 @@
"Html2Image": "IHtml2Image",
"Html2Pdf": "IHtml2Pdf",
"HtmlRenderer": "HtmlRenderer",
"BootstrapBlazorIcon": "Icon",
"IconPark": "ByteDance IconPark",
"Icons": "Icons",
"IFrame": "IFrame",
"ImageCropper": "ImageCropper",
"ImageViewer": "ImageViewer",
"BootstrapInput": "BootstrapInput",
"BootstrapInputGroup": "BootstrapInputGroup",
"BootstrapInputNumber": "BootstrapInputNumber",
"InputUpload": "InputUpload",
"Install": "Install",
"IntersectionObserver": "IntersectionObserver",
"Introduction": "Introduction",
"IpAddress": "IpAddress",
"JitViewer": "Jit Viewer",
"JSExtension": "JSRuntime Extensions",
"BootstrapLabel": "Labels",
"Layout": "Layout",
"LayoutComponents": "Layouts",
"LayoutPage": "Admin Template",
Expand Down Expand Up @@ -525,6 +525,9 @@
"Title": "Globalization"
},
"BootstrapBlazor.Server.Components.Pages.GlobalOption": {
"DateTimeSettingsIntro": "Use this configuration to customize the text conversion logic of the <code>DateTimePicker</code> component when <code>IsEditable=\"true\"</code>. The global configuration is used when no component-level callback is set; a component-level callback takes precedence over the global configuration.",
"DateTimeSettingsParseDateTimeCallback": "<code>ParseDateTimeCallback</code> Custom callback for parsing <code>DateTime</code>",
"DateTimeSettingsParseDateTimeOffsetCallback": "<code>ParseDateTimeOffsetCallback</code> Custom callback for parsing <code>DateTimeOffset</code>",
"SubTitle": "Added component <code>ErrorLogger</code> Through this component, global logs and exceptions can be output uniformly; currently, the <code>Blazor</code> framework does not provide a <code>MVC</code> like <b>Global exception</b> The overall solution",
"Title": "Global exception"
},
Expand Down Expand Up @@ -1679,7 +1682,9 @@
"FeatureShowLunarIntro": "<code>ShowLunar</code> Whether to display the lunar calendar",
"FeatureShowSolarTerm": "Solar Term",
"FeatureShowSolarTermIntro": "<code>ShowSolarTerm</code> Whether to display the 24 solar terms",
"IsEditableIntro": "Enable manual input function by setting <code>IsEditable=\"true\"</code>",
"IsEditableCallbackTip": "To automatically convert entered text to <code>DateTime</code>/<code>DateTimeOffset</code>, use the component-level <code>ParseDateTimeCallback</code> and <code>ParseDateTimeOffsetCallback</code> parameters to customize the conversion logic. Corresponding options are also available through the <code>DateTimeSettings</code> property of the global <code><a href=\"global-option\" target=\"_blank\">BootstrapBlazorOptions</a></code> configuration. The component callback takes precedence, followed by the global callback. If neither is configured, the default <code>DateTimeHelper.ToDateTime</code> conversion logic is used.",
"IsEditableIntro": "Enable manual date input by setting <code>IsEditable=\"true\"</code>, and customize how the input text is converted to a date with <code>ParseDateTimeCallback</code>",
"IsEditableTip": "This example sets <code>ParseDateTimeCallback</code> to convert text in <code>yyyyMMdd</code> format to a date. Try entering <code>20250808</code>. When binding to <code>DateTimeOffset</code> or <code>DateTimeOffset?</code>, use <code>ParseDateTimeOffsetCallback</code> to customize the conversion logic",
"IsEditableTitle": "Editable",
"MinValueIntro": "Set the <code>MinValue</code> property value to the <code>MaxValue</code> limit the range of optional values, in this case setting the range to <b>45</b>days",
"MinValueTitle": "Set the range of values",
Expand Down Expand Up @@ -3345,6 +3350,54 @@
"Scale2ButtonText": "ZoomIn",
"SetDataButtonText": "SetData"
},
"BootstrapBlazor.Server.Components.Samples.Modals": {
"ModalsBigPopup": "big popup",
"ModalsCenterVerticallyIntro": "Set the vertical centering of the popup component via <code>IsCentered</code>",
"ModalsCenterVerticallyTitle": "Center vertically",
"ModalsDescription": "Inform the user and host relevant actions while preserving the current page state",
"ModalsDialogResizeIntro": "Resize the modal box by setting the <code>ShowResize</code> property",
"ModalsDialogResizeTitle": "Resize",
"ModalsDialogSizeIntro": "Set the size of the popup component through <code>Size</code>",
"ModalsDialogSizeTitle": "Bullet size",
"ModalsFullScreenPopup": "Full screen popup",
"ModalsFullScreenPopup1200": "Full screen popup(<1200px)",
"ModalsFullScreenPopup1400": "Full screen popup(<1400px)",
"ModalsFullScreenPopup992": "Full screen popup(<992px)",
"ModalsFullScreenSizeIntro": "Just set the property <code>FullScreenSize</code>",
"ModalsFullScreenSizeTitle": "Full screen popup",
"ModalsIsBackdropIntro": "Click the area outside the pop-up window to close the pop-up window effect by default",
"ModalsIsBackdropTitle": "IsBackdrop background off mode",
"ModalsIsBackdropToClose": "Click on the background to close the popup",
"ModalsIsDraggableIntro": "Click on the title bar of the pop-up window to drag and drop the pop-up window",
"ModalsIsDraggableTitle": "Draggable popup",
"ModalsLargeFullScreenPopup": "Large full screen popup",
"ModalsLargeFullScreenPopupWindow": "Large full-screen pop-up window",
"ModalsLongContentIntro": "Use <code>IsScrolling</code> to set the scroll wheel sliding function of the pop-up frame component for the excess content",
"ModalsLongContentTitle": "Extra long content",
"ModalsMaximizeIntro": "Show the maximize button by setting the <code>ShowMaximinzeButton</code> popup",
"ModalsMaximizePopup": "Maximize popup",
"ModalsMaximizeTitle": "Maximize button",
"ModalsNormalDefaultPopup": "Default popup",
"ModalsNormalDefaultPopupText": "I am the text in the pop-up window",
"ModalsNormalIntro": "A dialog box pops up, suitable for scenarios that require more customization",
"ModalsNormalIsKeyboard": "by setting <code>Modal</code> component <code>IsKeyboard:true</code> parameter, whether to open the pop-up window is supported <kbd>ESC</kbd>",
"ModalsNormalPopups": "Pop-ups",
"ModalsNormalPopupText": "popup text",
"ModalsNormalPopupTitle": "Popup title",
"ModalsNormalTitle": "Basic usage",
"ModalsOverSizedPopup": "OverSized pop-up window",
"ModalsResize": "Resize",
"ModalsScrollBarPopup": "Built-in scroll bar popup",
"ModalsShownCallbackAsyncIntro": "By setting the <code>ShowCallbackAsync</code> callback delegate, this method will be recalled after the pop-up window is displayed",
"ModalsShownCallbackAsyncTitle": "Popup shows callback method",
"ModalsSmallPopup": "small popup",
"ModalsSuperLargeFullScreenPopupWindow": "Super large full-screen pop-up window",
"ModalsSuperLargePopup": "super large pop-up window",
"ModalsTitle": "Modal box",
"ModalsTitlePopupWindowText": "I am the text in the pop-up window",
"ModalsVerticallyCenteredPopup": "Vertically centered popup",
"ModalsVeryLongContent": "Pop-up window with very long content"
},
"BootstrapBlazor.Server.Components.Samples.Modbus.ModbusFactories": {
"BenchmarkProjectIntro": "The project includes a Benchmark test project",
"BenchmarkResultIntro": "The Benchmark results are shown below:",
Expand All @@ -3366,9 +3419,9 @@
"FactoryMethodRtu": "Use <code>GetOrCreateRtuMaster</code> to get an <code>IModbusRtuClient</code> instance",
"FactoryMethodRtuOverTcp": "Use <code>GetOrCreateRtuOverTcpMaster</code> to get an <code>IModbusTcpClient</code> instance",
"FactoryMethodRtuOverUdp": "Use <code>GetOrCreateRtuOverUdpMaster</code> to get an <code>IModbusTcpClient</code> instance",
"FactoryMethodsTitle": "<code>IModbusFactory</code> instance methods",
"FactoryMethodTcp": "Use <code>GetOrCreateTcpMaster</code> to get an <code>IModbusTcpClient</code> instance",
"FactoryMethodUdp": "Use <code>GetOrCreateUdpMaster</code> to get an <code>IModbusTcpClient</code> instance",
"FactoryMethodsTitle": "<code>IModbusFactory</code> instance methods",
"FloatCustomExtensionIntro": "By accessing the raw <code>Buffer</code> through <code>IModbusResponse</code>, you can easily build custom extensions for your own business data types. For example, two consecutive registers can be interpreted as a 32-bit <b>floating-point</b> value that follows the IEEE 754 standard.",
"FloatEndiannessTips": "<b>Note:</b> when converting <code>Buffer</code> into custom types such as a 32-bit floating-point value, pay attention to endianness. Byte order changes how the data is interpreted, and the wrong byte order can produce incorrect results. Choose the proper conversion based on the actual device or protocol specification.",
"FloatIndexIntro": "In the methods above, the <code>index</code> parameter represents the float value index. Each <code>float</code> occupies 2 registers. If multiple float values are read at once, adjust <code>index</code> to access them in sequence.",
Expand Down Expand Up @@ -3399,54 +3452,6 @@
"TransportTcp": "<code>Modbus TCP/IP</code>: Runs over Ethernet using the <code>TCP/IP</code> protocol, with the default port <code>502</code>. It adds an MBAP header on top of the Modbus RTU protocol and omits the CRC checksum because TCP itself already provides a reliable connection service.",
"WasmTips": "Special note: this service does not support <code>wasm</code> mode"
},
"BootstrapBlazor.Server.Components.Samples.Modals": {
"ModalsBigPopup": "big popup",
"ModalsCenterVerticallyIntro": "Set the vertical centering of the popup component via <code>IsCentered</code>",
"ModalsCenterVerticallyTitle": "Center vertically",
"ModalsDescription": "Inform the user and host relevant actions while preserving the current page state",
"ModalsDialogResizeIntro": "Resize the modal box by setting the <code>ShowResize</code> property",
"ModalsDialogResizeTitle": "Resize",
"ModalsDialogSizeIntro": "Set the size of the popup component through <code>Size</code>",
"ModalsDialogSizeTitle": "Bullet size",
"ModalsFullScreenPopup": "Full screen popup",
"ModalsFullScreenPopup1200": "Full screen popup(<1200px)",
"ModalsFullScreenPopup1400": "Full screen popup(<1400px)",
"ModalsFullScreenPopup992": "Full screen popup(<992px)",
"ModalsFullScreenSizeIntro": "Just set the property <code>FullScreenSize</code>",
"ModalsFullScreenSizeTitle": "Full screen popup",
"ModalsIsBackdropIntro": "Click the area outside the pop-up window to close the pop-up window effect by default",
"ModalsIsBackdropTitle": "IsBackdrop background off mode",
"ModalsIsBackdropToClose": "Click on the background to close the popup",
"ModalsIsDraggableIntro": "Click on the title bar of the pop-up window to drag and drop the pop-up window",
"ModalsIsDraggableTitle": "Draggable popup",
"ModalsLargeFullScreenPopup": "Large full screen popup",
"ModalsLargeFullScreenPopupWindow": "Large full-screen pop-up window",
"ModalsLongContentIntro": "Use <code>IsScrolling</code> to set the scroll wheel sliding function of the pop-up frame component for the excess content",
"ModalsLongContentTitle": "Extra long content",
"ModalsMaximizeIntro": "Show the maximize button by setting the <code>ShowMaximinzeButton</code> popup",
"ModalsMaximizePopup": "Maximize popup",
"ModalsMaximizeTitle": "Maximize button",
"ModalsNormalDefaultPopup": "Default popup",
"ModalsNormalDefaultPopupText": "I am the text in the pop-up window",
"ModalsNormalIntro": "A dialog box pops up, suitable for scenarios that require more customization",
"ModalsNormalIsKeyboard": "by setting <code>Modal</code> component <code>IsKeyboard:true</code> parameter, whether to open the pop-up window is supported <kbd>ESC</kbd>",
"ModalsNormalPopups": "Pop-ups",
"ModalsNormalPopupText": "popup text",
"ModalsNormalPopupTitle": "Popup title",
"ModalsNormalTitle": "Basic usage",
"ModalsOverSizedPopup": "OverSized pop-up window",
"ModalsResize": "Resize",
"ModalsScrollBarPopup": "Built-in scroll bar popup",
"ModalsShownCallbackAsyncIntro": "By setting the <code>ShowCallbackAsync</code> callback delegate, this method will be recalled after the pop-up window is displayed",
"ModalsShownCallbackAsyncTitle": "Popup shows callback method",
"ModalsSmallPopup": "small popup",
"ModalsSuperLargeFullScreenPopupWindow": "Super large full-screen pop-up window",
"ModalsSuperLargePopup": "super large pop-up window",
"ModalsTitle": "Modal box",
"ModalsTitlePopupWindowText": "I am the text in the pop-up window",
"ModalsVerticallyCenteredPopup": "Vertically centered popup",
"ModalsVeryLongContent": "Pop-up window with very long content"
},
"BootstrapBlazor.Server.Components.Samples.MouseFollowers": {
"MouseFollowerIconIntro": "If you use SVG spritesheet in your project and want to display them in the cursor, then you can use this method. In this case, you need to specify the path to the SVG sprite in the options and set class names.",
"MouseFollowerIconTitle": "Icon mode",
Expand Down Expand Up @@ -5777,10 +5782,10 @@
"TransferBindTitle": "Two-way binding",
"TransferCustomerIntro": "You can customize the list title copy, button copy, rendering function of data items, check status copy at the bottom of the list, content area at the bottom of the list, and so on.",
"TransferCustomerTitle": "Customizable",
"TransferDisableIntro": "When you set the <code>IsDisabled</code> property value to <code>true</code>, the component suppresses input",
"TransferDisableTitle": "Disable",
"TransferDisabledCallbackIntro": "By setting the <code>OnDisabledCallback</code> callback method, you can control whether specific items are disabled. The first argument <code>target</code> identifies the current panel — <code>left</code> for the left panel and <code>right</code> for the right panel — so you can apply different disable rules to each side. The second argument is the <code>SelectedItem</code>, which is <code>null</code> for the header select-all option. In this example the left panel disables <code>2</code> <code>4</code> <code>6</code> and the right panel disables <code>5</code>. Disabled items cannot be checked and are excluded from the select-all/deselect-all operations",
"TransferDisabledCallbackTitle": "Disable specific items",
"TransferDisableIntro": "When you set the <code>IsDisabled</code> property value to <code>true</code>, the component suppresses input",
"TransferDisableTitle": "Disable",
"TransferItemClassIntro": "By setting the <code>OnSetItemClass</code> callback method styles options based on the<code> values of </code>SelectedItem",
"TransferItemClassTitle": "Set the Item style",
"TransferMinMaxIntro": "By setting <code>Min</code> <code>Max</code> Parameter to limit the number of options",
Expand Down
Loading
Loading