Skip to content

Commit 0c5707b

Browse files
authored
feat(ColorPicker): add Swatches parameter (#4562)
* fix: 修复 swatches 丢失问题 * chore: 更新依赖包到最新 * chore: 更新工具链 * doc: 更新文档 * doc: 更新键值 * doc: 更新参数文档 * bump version 8.11.1-beta01 * doc: 更正弹窗文本错误
1 parent c7be111 commit 0c5707b

File tree

8 files changed

+51
-16
lines changed

8 files changed

+51
-16
lines changed

src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@
2828
<PackageReference Include="BootstrapBlazor.BaiduSpeech" Version="8.1.1" />
2929
<PackageReference Include="BootstrapBlazor.BaiduOcr" Version="8.2.0" />
3030
<PackageReference Include="BootstrapBlazor.BarCode" Version="8.2.0" />
31-
<PackageReference Include="BootstrapBlazor.BarcodeGenerator" Version="8.2.0" />
31+
<PackageReference Include="BootstrapBlazor.BarcodeGenerator" Version="8.4.0" />
3232
<PackageReference Include="BootstrapBlazor.BootstrapIcon" Version="8.0.3" />
3333
<PackageReference Include="BootstrapBlazor.BootstrapIcon.Extensions" Version="8.2.0" />
3434
<PackageReference Include="BootstrapBlazor.Chart" Version="8.4.0" />
3535
<PackageReference Include="BootstrapBlazor.CherryMarkdown" Version="8.2.0" />
3636
<PackageReference Include="BootstrapBlazor.CodeEditor" Version="8.2.0" />
3737
<PackageReference Include="BootstrapBlazor.Dock" Version="8.3.0" />
38-
<PackageReference Include="BootstrapBlazor.DockView" Version="8.3.0" />
38+
<PackageReference Include="BootstrapBlazor.DockView" Version="8.4.0" />
3939
<PackageReference Include="BootstrapBlazor.DriverJs" Version="8.2.0" />
4040
<PackageReference Include="BootstrapBlazor.ElementIcon" Version="8.2.0" />
4141
<PackageReference Include="BootstrapBlazor.FileViewer" Version="8.3.0" />
@@ -44,7 +44,7 @@
4444
<PackageReference Include="BootstrapBlazor.Holiday" Version="8.2.0" />
4545
<PackageReference Include="BootstrapBlazor.Html2Pdf" Version="8.3.0" />
4646
<PackageReference Include="BootstrapBlazor.IconPark" Version="8.2.0" />
47-
<PackageReference Include="BootstrapBlazor.ImageCropper" Version="8.2.0" />
47+
<PackageReference Include="BootstrapBlazor.ImageCropper" Version="8.3.0" />
4848
<PackageReference Include="BootstrapBlazor.Live2DDisplay" Version="8.2.0" />
4949
<PackageReference Include="BootstrapBlazor.Markdown" Version="8.2.1" />
5050
<PackageReference Include="BootstrapBlazor.MaterialDesign" Version="8.1.0" />
@@ -55,7 +55,7 @@
5555
<PackageReference Include="BootstrapBlazor.MouseFollower" Version="8.2.0" />
5656
<PackageReference Include="BootstrapBlazor.OnScreenKeyboard" Version="8.0.4" />
5757
<PackageReference Include="BootstrapBlazor.PdfReader" Version="8.0.4" />
58-
<PackageReference Include="BootstrapBlazor.Player" Version="8.2.0" />
58+
<PackageReference Include="BootstrapBlazor.Player" Version="8.3.0" />
5959
<PackageReference Include="BootstrapBlazor.SignaturePad" Version="8.2.0" />
6060
<PackageReference Include="BootstrapBlazor.Sortable" Version="8.2.0" />
6161
<PackageReference Include="BootstrapBlazor.Splitting" Version="8.2.0" />
@@ -68,7 +68,7 @@
6868
<PackageReference Include="BootstrapBlazor.WebAPI" Version="8.0.5" />
6969
<PackageReference Include="BootstrapBlazor.WinBox" Version="8.2.0" />
7070
<PackageReference Include="Longbow.Logging" Version="8.1.0" />
71-
<PackageReference Include="Longbow.Tasks" Version="8.1.0" />
71+
<PackageReference Include="Longbow.Tasks" Version="8.2.0" />
7272
</ItemGroup>
7373

7474
<ItemGroup>

src/BootstrapBlazor.Server/Components/Samples/ColorPickers.razor.cs

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,41 @@ private AttributeItem[] GetAttributes() =>
6363
[
6464
new()
6565
{
66-
Name = "OnValueChanged",
67-
Description = Localizer["Event1"],
68-
Type = "Func<string, Task>",
66+
Name = nameof(ColorPicker.Template),
67+
Description = Localizer["AttributeTemplate"],
68+
Type = "RenderFragment<string>",
6969
ValueList = " — ",
7070
DefaultValue = " — "
7171
},
7272
new()
7373
{
74-
Name = nameof(ColorPicker.Template),
75-
Description = Localizer["EventTemplate"],
76-
Type = "Func<string>",
74+
Name = nameof(ColorPicker.Formatter),
75+
Description = Localizer["AttributeFormatter"],
76+
Type = "Func<string, Task<string>>",
77+
ValueList = " — ",
78+
DefaultValue = " — "
79+
},
80+
new()
81+
{
82+
Name = nameof(ColorPicker.IsSupportOpacity),
83+
Description = Localizer["AttributeIsSupportOpacity"],
84+
Type = "bool",
85+
ValueList = "true|false",
86+
DefaultValue = "false"
87+
},
88+
new()
89+
{
90+
Name = nameof(ColorPicker.Swatches),
91+
Description = Localizer["AttributeSwatches"],
92+
Type = "bool",
93+
ValueList = " — ",
94+
DefaultValue = " — "
95+
},
96+
new()
97+
{
98+
Name = nameof(ColorPicker.OnValueChanged),
99+
Description = Localizer["EventOnValueChanged"],
100+
Type = "Func<string, Task>",
77101
ValueList = " — ",
78102
DefaultValue = " — "
79103
}

src/BootstrapBlazor.Server/Components/Samples/Dialogs.razor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ private async Task OnResultDialogClick()
165165

166166
private async Task OnConfirmModalClick()
167167
{
168-
var result = await DialogService.ShowModal(Localizer["ConfirmDialogModalContent"], Localizer["ConfirmDialogModalTitle"]);
168+
var result = await DialogService.ShowModal(Localizer["ConfirmDialogModalTitle"], Localizer["ConfirmDialogModalContent"]);
169169

170170
ModalDialogLogger.Log($"The return value of the popup window is: {result} no component provider");
171171
}

src/BootstrapBlazor.Server/Locales/en-US.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2490,7 +2490,11 @@
24902490
"ValidateFormIntro": "Built in <code>ValidateForm</code> to use",
24912491
"IsSupportOpacityTitle": "Support Opacity",
24922492
"IsSupportOpacityIntro": "Enable transparency support by setting <code>IsSupportOpacity=\"true\"</code>",
2493-
"Event1": "Color change callback delegate method"
2493+
"EventOnValueChanged": "Color change callback delegate method",
2494+
"AttributeTemplate": "The template for display",
2495+
"AttributeFormatter": "Display color value formatting callback method",
2496+
"AttributeIsSupportOpacity": "Whether to support transparency",
2497+
"AttributeSwatches": "Preset candidate colors"
24942498
},
24952499
"BootstrapBlazor.Server.Components.Samples.DateTimePickers": {
24962500
"Title": "DatePicker",

src/BootstrapBlazor.Server/Locales/zh-CN.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2490,7 +2490,11 @@
24902490
"ValidateFormIntro": "内置于 <code>ValidateForm</code> 中使用",
24912491
"IsSupportOpacityTitle": "支持透明度",
24922492
"IsSupportOpacityIntro": "通过设置 <code>IsSupportOpacity=\"true\"</code> 开启透明度支持",
2493-
"Event1": "颜色改变回调委托方法"
2493+
"EventOnValueChanged": "颜色改变回调委托方法",
2494+
"AttributeTemplate": "显示模板",
2495+
"AttributeFormatter": "显示颜色值格式化回调方法",
2496+
"AttributeIsSupportOpacity": "是否支持透明度",
2497+
"AttributeSwatches": "预设候选颜色"
24942498
},
24952499
"BootstrapBlazor.Server.Components.Samples.DateTimePickers": {
24962500
"Title": "DatePicker 日期选择器",

src/BootstrapBlazor/BootstrapBlazor.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<Version>8.11.0</Version>
4+
<Version>8.11.1-beta01</Version>
55
</PropertyGroup>
66

77
<ItemGroup>

src/BootstrapBlazor/Components/ColorPicker/ColorPicker.razor.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ const getOptions = (el, options) => {
8686
options.default = options.value;
8787
delete options.value;
8888
}
89+
if (options.swatches === null) {
90+
delete options.swatches;
91+
}
8992
const config = {
9093
el,
9194
theme: 'nano',

src/BootstrapBlazor/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
</ItemGroup>
6565

6666
<ItemGroup>
67-
<PackageReference Include="AspNetCore.SassCompiler" Version="1.79.5" Condition="'$(Configuration)'=='Debug' and '$(TargetFramework)' == 'net8.0'" />
67+
<PackageReference Include="AspNetCore.SassCompiler" Version="1.80.4" Condition="'$(Configuration)'=='Debug' and '$(TargetFramework)' == 'net8.0'" />
6868
</ItemGroup>
6969

7070
<ItemGroup>

0 commit comments

Comments
 (0)