+
+
diff --git a/src/BootstrapBlazor.Server/Components/Samples/DateTimePickers.razor.cs b/src/BootstrapBlazor.Server/Components/Samples/DateTimePickers.razor.cs
index 11477f88ad5..0d64dc10031 100644
--- a/src/BootstrapBlazor.Server/Components/Samples/DateTimePickers.razor.cs
+++ b/src/BootstrapBlazor.Server/Components/Samples/DateTimePickers.razor.cs
@@ -90,6 +90,54 @@ private string BindValueString
private bool _showSolarTerm = true;
private bool _showFestivals = true;
private bool _showHolidays = true;
+ private bool _disableWeekend = true;
+ private bool _disableToday = true;
+ private DateTime? _disabledNullValue = DateTime.Today;
+ private DateTime _disabledValue = DateTime.Today;
+
+ private async Task> OnGetDisabledDaysCallback(DateTime start, DateTime end)
+ {
+ var ret = new List();
+ if (_disableWeekend)
+ {
+ var day = start;
+ while (day <= end)
+ {
+ if (day.DayOfWeek is DayOfWeek.Sunday or DayOfWeek.Saturday)
+ {
+ ret.Add(day);
+ }
+ day = day.AddDays(1);
+ }
+
+ if (DateTime.Today.DayOfWeek is DayOfWeek.Sunday or DayOfWeek.Saturday)
+ {
+ // 处理今天是否禁用
+ ret.Add(DateTime.Today);
+ }
+ }
+
+ if (_disableToday)
+ {
+ // 处理今天是否禁用
+ ret.Add(DateTime.Today);
+ }
+
+ // 模拟异步延迟
+ await Task.Delay(100);
+ return ret;
+ }
+
+ private DateTimePicker _picker1 = default!;
+
+ private DateTimePicker _picker2 = default!;
+
+ private Task OnDisabledDaysChanged(bool v)
+ {
+ _picker1.ClearDisabledDays();
+ _picker2.ClearDisabledDays();
+ return Task.CompletedTask;
+ }
///
/// 获得事件方法
@@ -108,6 +156,12 @@ private EventItem[] GetEvents() =>
Name = "ValueChanged",
Description = Localizer["Event2"],
Type ="EventCallback"
+ },
+ new()
+ {
+ Name = "OnGetDisabledDaysCallback",
+ Description = Localizer["OnGetDisabledDaysCallbackEvent"],
+ Type ="Func>>"
}
];
@@ -214,6 +268,20 @@ private AttributeItem[] GetAttributes() =>
Type = "bool",
ValueList = "true/false",
DefaultValue = "false"
+ },
+ new() {
+ Name = "EnableDisabledDaysCache",
+ Description = Localizer["AttrEnableDisabledDaysCache"],
+ Type = "bool",
+ ValueList = "true/false",
+ DefaultValue = "true"
+ },
+ new() {
+ Name = "DisplayDisabledDayAsEmpty",
+ Description = Localizer["AttrDisplayDisabledDayAsEmpty"],
+ Type = "bool",
+ ValueList = "true/false",
+ DefaultValue = "false"
}
];
}
diff --git a/src/BootstrapBlazor.Server/Components/Samples/Toggles.razor.cs b/src/BootstrapBlazor.Server/Components/Samples/Toggles.razor.cs
index 98000a7b59f..11720383dd0 100644
--- a/src/BootstrapBlazor.Server/Components/Samples/Toggles.razor.cs
+++ b/src/BootstrapBlazor.Server/Components/Samples/Toggles.razor.cs
@@ -71,7 +71,7 @@ private AttributeItem[] GetAttributes() =>
Description = Localizer["OffTextAttr"],
Type = "string",
ValueList = "—",
- DefaultValue = Localizer["OffTextDefautValue"]!
+ DefaultValue = Localizer["OffTextDefaultValue"]!
},
new()
{
@@ -79,7 +79,7 @@ private AttributeItem[] GetAttributes() =>
Description = Localizer["OnTextAttr"],
Type = "string",
ValueList = "—",
- DefaultValue = Localizer["OnTextDefautValue"]!
+ DefaultValue = Localizer["OnTextDefaultValue"]!
},
new()
{
diff --git a/src/BootstrapBlazor.Server/Locales/en-US.json b/src/BootstrapBlazor.Server/Locales/en-US.json
index 22488952715..3584a5c9621 100644
--- a/src/BootstrapBlazor.Server/Locales/en-US.json
+++ b/src/BootstrapBlazor.Server/Locales/en-US.json
@@ -1030,8 +1030,8 @@
"BootstrapBlazor.Server.Components.Samples.Labels": {
"LabelsTitle": "Component label",
"LabelsDescription": "This set of components includes ValidateFormEditorForm and a variety of Form components inherited from ValidateBase<TValue>. Among these components There is a special set of display front label logic, now let’s sort it out in a unified way:",
- "LabelsDescriptionTips1": "The ValidateForm component is a verifiable form component. The form component in this component will automatically perform data compliance checks. If Data non-compliance will prevent the Submit action, which is the most frequently used component in data submission",
- "LabelsDescriptionTips2": "The EditorForm component is an ordinary form component. After this component is bound to the Model, the entire form can be automatically generated, which greatly reduces repetition Code, put the ValidateForm on the outside to open the data compliance check very convenient, concise and efficient",
+ "LabelsDescriptionTips1": "The ValidateForm component is a verifiable form component. The form component in this component will automatically perform data compliance checks. If Data non-compliance will prevent the Submit action, which is the most frequently used component in data submission",
+ "LabelsDescriptionTips2": "The EditorForm component is an ordinary form component. After this component is bound to the Model, the entire form can be automatically generated, which greatly reduces repetition Code, put the ValidateForm on the outside to open the data compliance check very convenient, concise and efficient",
"LabelsDescriptionTips3": "Take the BootstrapInput input box component as an example to explain whether to display the Label logic",
"LabelsTips": "The logic of ShowLabel is the principle of proximity. The closer the setting is to itself, the setting takes effect. For example, the form component is built into the ValidateForm component, even if ValidateForm is set to >ShowLabel=true, when the form component itself sets ShowLabel=false, the final result of the label is not displayed",
"LabelsNormalTitle": "Use alone",
@@ -1074,11 +1074,11 @@
"BootstrapBlazor.Server.Components.Pages.Install": {
"InstallTitle": "Install",
"GitP1": "There are many kinds of Git tools that everyone is familiar with, here I introduce two Git client tools",
- "GitP2": "It is recommended to use the Fork tool to install, it can better and Visutal Studio to use with development tools.",
+ "GitP2": "It is recommended to use the Fork tool to install, it can better and Visual Studio to use with development tools.",
"NugetInstall": "Nuget Install",
"NugetP1": "Use nuget.org to install BootstrapBlazor components",
"EnvBuildTitle": "Project Environment Construction",
- "EnvLi1": "Install .net core sdk Official Website",
+ "EnvLi1": "Install .net core sdk Official Website",
"EnvLi2": "Install Visual Studio 2022 and above Official website",
"EnvLi3": "Pull the project code BootstrapBlazor Warehouse URL"
},
@@ -1089,7 +1089,7 @@
},
"BootstrapBlazor.Server.Components.Components.UpdateIntro": {
"H1": "Component library updated to",
- "B1": "Bootstrap Blazor at present has more than 120 components. This component is based on",
+ "B1": "Bootstrap Blazor at present has nearly 200 components. This component is based on",
"B2": "An enterprise-level component library that provides several types of common components such as layout, navigation, form, data, notification, icon, voice, etc. Each component has been carefully designed with modularity, responsiveness and excellent performance. Starting from more practical scenarios, meeting the needs of various scenarios, greatly reducing the time cost of developers, greatly shortening the development cycle, greatly improving development efficiency, and providing a set of",
"B3": "General Rights Management System",
"B4": "Example project",
@@ -2494,7 +2494,7 @@
"Description": "Used to select or enter a date",
"NormalTitle": "Select the day",
"NormalIntro": "Select the control based on the date of the day in 「day」as the base unit",
- "ShowIconTitle": "Wether show the component icon",
+ "ShowIconTitle": "Whether show the component icon",
"ShowIconIntro": "Save space by setting ShowIcon=\"false\" to not display component icons",
"ValidateFormTitle": "Client validation",
"ValidateFormIntro": "Check data validity and prompt automatically based on custom validation rules",
@@ -2523,12 +2523,12 @@
"BlockAutoCloseIntro": "Auto close the popup window by se AutoClose to true",
"BlockAutoCloseDesc": "AutoClose The default value is true When selecting a date, the pop-up window will automatically close. When the value is set to false, the pop-up window needs to be closed when the confirm button is clicked",
"BlockGroupTitle": "InputGroup",
- "BlockGroupIntro": "combox with BootstrapInputGroupLabel inside BootstrapInputGroupLabel",
+ "BlockGroupIntro": "Used in the built-in BootstrapInputGroup and in combination with BootstrapInputGroupLabel",
"Att1": "Whether to display the front label",
"Att2": "Whether to display the shortcut sidebar",
"Att3": "The front label displays text",
"Att4": "Date format string The default is yyyyy-MM-dd",
- "Att6": "Whether to disable Fasle by default",
+ "Att6": "Whether to disable False by default",
"Att8": "The value of the component is a two-way binding with ValueChanged",
"Att9": "Get/Set Component display mode The default is the month-to-day display mode",
"AttrAutoClose": "Whether auto close the popup window",
@@ -2544,8 +2544,6 @@
"ValidateFormValue": "DateTimePick",
"DateTimePickerTitle": "Select the time",
"DateTimePickerIntro": "Select the hour, minute, and second on the clock dial to obtain the current date and time.",
- "ShowLunarTitle": "Show lunar",
- "ShowLunarIntro": "Display the lunar calendar by setting ShowLunar=\"true\"",
"DayTemplateTitle": "Custom date display",
"DayTemplateIntro": "By setting the DayTemplate custom display template, the disabled date template is DayDisabledTemplate",
"AttrShowLunar": "Whether to display ChineseLunar",
@@ -2558,7 +2556,22 @@
"FeatureShowFestivals": "Festivals",
"FeatureShowHolidays": "Holidays",
"FeatureIntro": "Holidays Functional dependency component packages BootstrapBlazor.Holiday[Portal]",
- "FeatureFestivalIntro": "The festival function is provided by the built-in service ICalendarFestivals in the component library. The built-in default implementation provides 12 Gregorian festivals and 7 lunar festivals, which can be extended through custom festival services. For detailed function introductions, please refer to the Festival Services documentation [Portal]"
+ "FeatureFestivalIntro": "The festival function is provided by the built-in service ICalendarFestivals in the component library. The built-in default implementation provides 12 Gregorian festivals and 7 lunar festivals, which can be extended through custom festival services. For detailed function introductions, please refer to the Festival Services documentation [Portal]",
+ "DisableOptions": "Disable options",
+ "DisableWeekend": "Disable weekend",
+ "DisableToday": "Disable today",
+ "DisableDayCallbackTitle": "Customize the disable date",
+ "DisableDayCallbackIntro": "Customize which days need to be disabled by setting OnGetDisabledDaysCallback",
+ "DisableDayCallbackTip": "
When a component is assigned a disabled date, the component still displays its value by default. If you need to display the disabled date as an empty string, please set DisplayDisabledDayAsEmpty=\"true\"
This example uses slightly more complex logic to determine the disabled date. The disabled date is a combination of conditions, so when the conditions change, you need to call the component instance method ClearDisabledDays to clear the internal cache
In this example, the first component has DisplayDisabledDayAsEmpty=\"true\" set, so the component value is DateTime.Today and the displayed value is empty string
In this example, the data type of the second component is non-nullable type. Since the default value of the parameter AutoToday is true So even if the initial value is DateTime.MinValue, its display value is DateTime.Today Even when today is disabled, it is still displayed. If you need to display an empty string, please set DisplayDisabledDayAsEmpty=\"true\"
",
+ "DisableDayCallbackAllowNullDisplayText": "DateTime?",
+ "DisableDayCallbackNotAllowNullDisplayText": "DateTime",
+ "FeatureShowLunarIntro": "ShowLunar Whether to display the lunar calendar",
+ "FeatureShowSolarTermIntro": "ShowSolarTerm Whether to display the 24 solar terms",
+ "FeatureShowFestivalsIntro": "ShowFestivals Whether to display festivals",
+ "FeatureShowHolidaysIntro": "ShowHolidays Whether to display holidays",
+ "OnGetDisabledDaysCallbackEvent": "Disable date callback method",
+ "AttrEnableDisabledDaysCache": "Whether to enable custom disabled date cache",
+ "AttrDisplayDisabledDayAsEmpty": "Display disabled date as an empty string"
},
"BootstrapBlazor.Server.Components.Samples.TimePickers": {
"Title": "TimePicker",
@@ -3289,9 +3302,9 @@
"Color": "Color",
"IsDisabled": "Whether to disable it",
"OffTextAttr": "The text is displayed when the component is off",
- "OffTextDefautValue": "Shrink",
+ "OffTextDefaultValue": "Shrink",
"OnTextAttr": "The text is displayed when component On",
- "OnTextDefautValue": "Unfold",
+ "OnTextDefaultValue": "Unfold",
"Width": "The width of the component",
"Value": "Get the value",
"ShowLabel": "Whether to display the front label",
@@ -3354,7 +3367,7 @@
"UploadNormalTitle": "Basic usage",
"UploadNormalIntro": "The InputUpload component is used with other form components to display the file name, select the file and upload it by clicking the browse button, and by setting the ShowRemoveButton parameter, display the delete button, click the delete button to call back onDelete delegate method",
"UploadNormalLabelName": "Name:",
- "UploadNormalLabelAddress": "Adress:",
+ "UploadNormalLabelAddress": "Address:",
"UploadNormalLabelPhoto": "Photo:",
"UploadFormSettingsTitle": "FormSettings",
"UploadFormSettingsIntro": "Use the file upload component to constrain the file format within the form",
@@ -3376,7 +3389,7 @@
"AvatarUploadTips2": "Round avatar frame",
"AvatarUploadTips3": "When you set up IsSingle, you can upload only one image or file",
"AvatarUploadTips4": "
The component provides Accept property for upload file filtering, in this case the circular avatar box accepts both GIF and JPEG images, sets the Accept='image/gif, image/jpeg' and can be written as: Accept='image/*' if you don't restrict the format of the image. Whether this property is not secure or should be to file format validation using the server-side authentication