Skip to content

Commit 44da935

Browse files
authored
doc(SortableList): update parameter document (#4756)
* chore: bump version 9.0.1 * doc: 增加参数说明文档 * doc: 精简代码
1 parent 5405bf0 commit 44da935

File tree

6 files changed

+57
-13
lines changed

6 files changed

+57
-13
lines changed

src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
<PackageReference Include="BootstrapBlazor.PdfReader" Version="9.0.0" />
5858
<PackageReference Include="BootstrapBlazor.Player" Version="9.0.0" />
5959
<PackageReference Include="BootstrapBlazor.SignaturePad" Version="9.0.0" />
60-
<PackageReference Include="BootstrapBlazor.Sortable" Version="9.0.0" />
60+
<PackageReference Include="BootstrapBlazor.Sortable" Version="9.0.1" />
6161
<PackageReference Include="BootstrapBlazor.Splitting" Version="9.0.0" />
6262
<PackageReference Include="BootstrapBlazor.SvgEditor" Version="9.0.0" />
6363
<PackageReference Include="BootstrapBlazor.SummerNote" Version="9.0.1" />

src/BootstrapBlazor.Server/Components/Samples/Charts/Bar.razor.cs

+8-10
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ namespace BootstrapBlazor.Server.Components.Samples.Charts;
1010
/// </summary>
1111
public partial class Bar
1212
{
13-
private Random Randomer { get; } = new Random();
14-
1513
private int _barDatasetCount = 2;
1614
private int _barDataCount = 7;
1715

@@ -68,7 +66,7 @@ private Task<ChartDataSource> OnInit(bool stacked, bool setTitle = true)
6866
ds.Labels = Enumerable.Range(1, _barDataCount).Select(i => i.ToString());
6967
for (var index = 0; index < _barDatasetCount; index++)
7068
{
71-
ds.Data.Add(new ChartDataset() { Label = $"Set {index}", Data = Enumerable.Range(1, _barDataCount).Select(i => Randomer.Next(20, 37)).Cast<object>() });
69+
ds.Data.Add(new ChartDataset() { Label = $"Set {index}", Data = Enumerable.Range(1, _barDataCount).Select(i => Random.Shared.Next(20, 37)).Cast<object>() });
7270
}
7371

7472
return Task.FromResult(ds);
@@ -99,7 +97,7 @@ private Task OnPlayChart()
9997
/// </summary>
10098
private Task OnReloadChart()
10199
{
102-
BarDataCount = Randomer.Next(5, 15);
100+
BarDataCount = Random.Shared.Next(5, 15);
103101
BarChart.Reload();
104102
return Task.CompletedTask;
105103
}
@@ -124,7 +122,7 @@ private Task<ChartDataSource> OnInitTwoYAxes(bool stacked, bool setTitle = true)
124122
{
125123
Label = $"Y2 Set {index}",
126124
IsAxisY2 = index == 0,
127-
Data = Enumerable.Range(1, BarDataCount).Select(i => Randomer.Next(20, 7000)).Cast<object>()
125+
Data = Enumerable.Range(1, BarDataCount).Select(i => Random.Shared.Next(20, 7000)).Cast<object>()
128126
});
129127

130128
for (index = 1; index < BarDatasetCount; index++)
@@ -133,7 +131,7 @@ private Task<ChartDataSource> OnInitTwoYAxes(bool stacked, bool setTitle = true)
133131
{
134132
Label = $"Y Set {index}",
135133
IsAxisY2 = index == 0,
136-
Data = Enumerable.Range(1, BarDataCount).Select(i => Randomer.Next(20, 37)).Cast<object>()
134+
Data = Enumerable.Range(1, BarDataCount).Select(i => Random.Shared.Next(20, 37)).Cast<object>()
137135
});
138136
}
139137
return Task.FromResult(ds);
@@ -156,7 +154,7 @@ private Task<ChartDataSource> OnInitStack(bool stacked, bool setTitle = true)
156154
ds.Data.Add(new ChartDataset()
157155
{
158156
Label = $"Set {index}",
159-
Data = Enumerable.Range(1, BarDataCount).Select(i => Randomer.Next(20, 37)).Cast<object>()
157+
Data = Enumerable.Range(1, BarDataCount).Select(i => Random.Shared.Next(20, 37)).Cast<object>()
160158
});
161159
}
162160
return Task.FromResult(ds);
@@ -176,7 +174,7 @@ private Task<ChartDataSource> OnInitAspectRatio(bool stacked)
176174
ds.Data.Add(new ChartDataset()
177175
{
178176
Label = $"Set {index}",
179-
Data = Enumerable.Range(1, BarDataCount).Select(i => Randomer.Next(20, 37)).Cast<object>()
177+
Data = Enumerable.Range(1, BarDataCount).Select(i => Random.Shared.Next(20, 37)).Cast<object>()
180178
});
181179
}
182180
return Task.FromResult(ds);
@@ -198,7 +196,7 @@ private Task<ChartDataSource> OnInitShowDataLabel(bool showDataLabel)
198196
ds.Data.Add(new ChartDataset()
199197
{
200198
Label = $"Set {0}",
201-
Data = Enumerable.Range(1, BarDataCount).Select(i => Randomer.Next(20, 37)).Cast<object>()
199+
Data = Enumerable.Range(1, BarDataCount).Select(i => Random.Shared.Next(20, 37)).Cast<object>()
202200
});
203201
return Task.FromResult(ds);
204202
}
@@ -215,7 +213,7 @@ private Task<ChartDataSource> OnInitBarColorSeparately(bool barColorSeparately)
215213
ds.Data.Add(new ChartDataset()
216214
{
217215
Label = $"Set {0}",
218-
Data = Enumerable.Range(1, BarDataCount).Select(i => Randomer.Next(20, 37)).Cast<object>(),
216+
Data = Enumerable.Range(1, BarDataCount).Select(i => Random.Shared.Next(20, 37)).Cast<object>(),
219217
BackgroundColor = ["rgb(54, 162, 235, 0.5)", "rgb(75, 192, 192, 0.5)", "rgb(255, 99, 132, 0.5)", "rgb(255, 159, 64, 0.5)", "rgb(255, 205, 86, 0.5)", "rgb(255, 99, 71, 0.5)", "rgb(255, 192, 203, 0.5)"],
220218
BorderColor = ["rgb(54, 162, 235)", "rgb(75, 192, 192)", "rgb(255, 99, 132)", "rgb(255, 159, 64)", "rgb(255, 205, 86)", "rgb(255, 99, 71)", "rgb(255, 192, 203)"]
221219
});

src/BootstrapBlazor.Server/Components/Samples/SortableLists.razor

+2
Original file line numberDiff line numberDiff line change
@@ -267,3 +267,5 @@
267267
</div>
268268
</div>
269269
</DemoBlock>
270+
271+
<AttributeTable Items="@GetAttributes()" />

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

+36
Original file line numberDiff line numberDiff line change
@@ -299,4 +299,40 @@ private Task OnRemoveItems3(SortableEvent @event)
299299
AddItems3.RemoveAt(@event.OldIndex);
300300
return Task.CompletedTask;
301301
}
302+
303+
private AttributeItem[] GetAttributes() =>
304+
[
305+
new()
306+
{
307+
Name = nameof(SortableList.Option),
308+
Description = Localizer["AttributeSortableListOption"],
309+
Type = "SortableOption",
310+
ValueList = " — ",
311+
DefaultValue = "false"
312+
},
313+
new()
314+
{
315+
Name = nameof(SortableList.OnAdd),
316+
Description = Localizer["AttributeOnAdd"],
317+
Type = "Func<SortableEvent, Task>",
318+
ValueList = " — ",
319+
DefaultValue = " — "
320+
},
321+
new()
322+
{
323+
Name = nameof(SortableList.OnUpdate),
324+
Description = Localizer["AttributeOnUpdate"],
325+
Type = "Func<SortableEvent, Task>",
326+
ValueList = " — ",
327+
DefaultValue = " — "
328+
},
329+
new()
330+
{
331+
Name = nameof(SortableList.OnRemove),
332+
Description = Localizer["AttributeOnRemove"],
333+
Type = "Func<SortableEvent, Task>",
334+
ValueList = " — ",
335+
DefaultValue = " — "
336+
}
337+
];
302338
}

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

+5-1
Original file line numberDiff line numberDiff line change
@@ -6803,7 +6803,11 @@
68036803
"SortableListSwapTitle": "Swap",
68046804
"SortableListSwapIntro": "By setting the <code>Swap</code> parameter of <code>SortableListOption</code>, the drag item and the target item are swapped.",
68056805
"SortableListOnAddTitle": "Multiple SortableList",
6806-
"SortableListOnAddIntro": "Get the <code>SortableList</code> to which the dragged item belongs by setting the <code>FromId</code> parameter of the <code>SortableEvent</code>. In this example, the elements in the three areas can be dragged arbitrarily"
6806+
"SortableListOnAddIntro": "Get the <code>SortableList</code> to which the dragged item belongs by setting the <code>FromId</code> parameter of the <code>SortableEvent</code>. In this example, the elements in the three areas can be dragged arbitrarily",
6807+
"AttributeSortableListOption": "SortableListOption instance",
6808+
"AttributeOnAdd": "Callback method when adding elements",
6809+
"AttributeOnUpdate": "Callback method when updating elements",
6810+
"AttributeOnRemove": "Callback method when deleting elements"
68076811
},
68086812
"BootstrapBlazor.Server.Components.Samples.WinBoxes": {
68096813
"WinBoxTitle": "WinBox",

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

+5-1
Original file line numberDiff line numberDiff line change
@@ -6803,7 +6803,11 @@
68036803
"SortableListSwapTitle": "交换",
68046804
"SortableListSwapIntro": "通过设置 <code>SortableListOption</code> 参数 <code>Swap</code> 设置拖拽项与目标项目交换",
68056805
"SortableListOnAddTitle": "多区域拖动",
6806-
"SortableListOnAddIntro": "通过设置 <code>SortableEvent</code> 参数 <code>FromId</code> 获得拖动项所属 <code>SortableList</code>。本示例中三个区域内元素可以任意拖动"
6806+
"SortableListOnAddIntro": "通过设置 <code>SortableEvent</code> 参数 <code>FromId</code> 获得拖动项所属 <code>SortableList</code>。本示例中三个区域内元素可以任意拖动",
6807+
"AttributeSortableListOption": "SortableListOption 实例",
6808+
"AttributeOnAdd": "增加元素时回调方法",
6809+
"AttributeOnUpdate": "更新元素时回调方法",
6810+
"AttributeOnRemove": "删除元素时回调方法"
68076811
},
68086812
"BootstrapBlazor.Server.Components.Samples.WinBoxes": {
68096813
"WinBoxTitle": "WinBox 窗口组件",

0 commit comments

Comments
 (0)