Skip to content

Commit

Permalink
doc(SortableList): update parameter document (#4756)
Browse files Browse the repository at this point in the history
* chore: bump version 9.0.1

* doc: 增加参数说明文档

* doc: 精简代码
  • Loading branch information
ArgoZhang authored Nov 29, 2024
1 parent 5405bf0 commit 44da935
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<PackageReference Include="BootstrapBlazor.PdfReader" Version="9.0.0" />
<PackageReference Include="BootstrapBlazor.Player" Version="9.0.0" />
<PackageReference Include="BootstrapBlazor.SignaturePad" Version="9.0.0" />
<PackageReference Include="BootstrapBlazor.Sortable" Version="9.0.0" />
<PackageReference Include="BootstrapBlazor.Sortable" Version="9.0.1" />
<PackageReference Include="BootstrapBlazor.Splitting" Version="9.0.0" />
<PackageReference Include="BootstrapBlazor.SvgEditor" Version="9.0.0" />
<PackageReference Include="BootstrapBlazor.SummerNote" Version="9.0.1" />
Expand Down
18 changes: 8 additions & 10 deletions src/BootstrapBlazor.Server/Components/Samples/Charts/Bar.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ namespace BootstrapBlazor.Server.Components.Samples.Charts;
/// </summary>
public partial class Bar
{
private Random Randomer { get; } = new Random();

private int _barDatasetCount = 2;
private int _barDataCount = 7;

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

return Task.FromResult(ds);
Expand Down Expand Up @@ -99,7 +97,7 @@ private Task OnPlayChart()
/// </summary>
private Task OnReloadChart()
{
BarDataCount = Randomer.Next(5, 15);
BarDataCount = Random.Shared.Next(5, 15);
BarChart.Reload();
return Task.CompletedTask;
}
Expand All @@ -124,7 +122,7 @@ private Task<ChartDataSource> OnInitTwoYAxes(bool stacked, bool setTitle = true)
{
Label = $"Y2 Set {index}",
IsAxisY2 = index == 0,
Data = Enumerable.Range(1, BarDataCount).Select(i => Randomer.Next(20, 7000)).Cast<object>()
Data = Enumerable.Range(1, BarDataCount).Select(i => Random.Shared.Next(20, 7000)).Cast<object>()
});

for (index = 1; index < BarDatasetCount; index++)
Expand All @@ -133,7 +131,7 @@ private Task<ChartDataSource> OnInitTwoYAxes(bool stacked, bool setTitle = true)
{
Label = $"Y Set {index}",
IsAxisY2 = index == 0,
Data = Enumerable.Range(1, BarDataCount).Select(i => Randomer.Next(20, 37)).Cast<object>()
Data = Enumerable.Range(1, BarDataCount).Select(i => Random.Shared.Next(20, 37)).Cast<object>()
});
}
return Task.FromResult(ds);
Expand All @@ -156,7 +154,7 @@ private Task<ChartDataSource> OnInitStack(bool stacked, bool setTitle = true)
ds.Data.Add(new ChartDataset()
{
Label = $"Set {index}",
Data = Enumerable.Range(1, BarDataCount).Select(i => Randomer.Next(20, 37)).Cast<object>()
Data = Enumerable.Range(1, BarDataCount).Select(i => Random.Shared.Next(20, 37)).Cast<object>()
});
}
return Task.FromResult(ds);
Expand All @@ -176,7 +174,7 @@ private Task<ChartDataSource> OnInitAspectRatio(bool stacked)
ds.Data.Add(new ChartDataset()
{
Label = $"Set {index}",
Data = Enumerable.Range(1, BarDataCount).Select(i => Randomer.Next(20, 37)).Cast<object>()
Data = Enumerable.Range(1, BarDataCount).Select(i => Random.Shared.Next(20, 37)).Cast<object>()
});
}
return Task.FromResult(ds);
Expand All @@ -198,7 +196,7 @@ private Task<ChartDataSource> OnInitShowDataLabel(bool showDataLabel)
ds.Data.Add(new ChartDataset()
{
Label = $"Set {0}",
Data = Enumerable.Range(1, BarDataCount).Select(i => Randomer.Next(20, 37)).Cast<object>()
Data = Enumerable.Range(1, BarDataCount).Select(i => Random.Shared.Next(20, 37)).Cast<object>()
});
return Task.FromResult(ds);
}
Expand All @@ -215,7 +213,7 @@ private Task<ChartDataSource> OnInitBarColorSeparately(bool barColorSeparately)
ds.Data.Add(new ChartDataset()
{
Label = $"Set {0}",
Data = Enumerable.Range(1, BarDataCount).Select(i => Randomer.Next(20, 37)).Cast<object>(),
Data = Enumerable.Range(1, BarDataCount).Select(i => Random.Shared.Next(20, 37)).Cast<object>(),
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)"],
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)"]
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,5 @@
</div>
</div>
</DemoBlock>

<AttributeTable Items="@GetAttributes()" />
Original file line number Diff line number Diff line change
Expand Up @@ -299,4 +299,40 @@ private Task OnRemoveItems3(SortableEvent @event)
AddItems3.RemoveAt(@event.OldIndex);
return Task.CompletedTask;
}

private AttributeItem[] GetAttributes() =>
[
new()
{
Name = nameof(SortableList.Option),
Description = Localizer["AttributeSortableListOption"],
Type = "SortableOption",
ValueList = " — ",
DefaultValue = "false"
},
new()
{
Name = nameof(SortableList.OnAdd),
Description = Localizer["AttributeOnAdd"],
Type = "Func<SortableEvent, Task>",
ValueList = " — ",
DefaultValue = " — "
},
new()
{
Name = nameof(SortableList.OnUpdate),
Description = Localizer["AttributeOnUpdate"],
Type = "Func<SortableEvent, Task>",
ValueList = " — ",
DefaultValue = " — "
},
new()
{
Name = nameof(SortableList.OnRemove),
Description = Localizer["AttributeOnRemove"],
Type = "Func<SortableEvent, Task>",
ValueList = " — ",
DefaultValue = " — "
}
];
}
6 changes: 5 additions & 1 deletion src/BootstrapBlazor.Server/Locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -6803,7 +6803,11 @@
"SortableListSwapTitle": "Swap",
"SortableListSwapIntro": "By setting the <code>Swap</code> parameter of <code>SortableListOption</code>, the drag item and the target item are swapped.",
"SortableListOnAddTitle": "Multiple SortableList",
"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"
"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",
"AttributeSortableListOption": "SortableListOption instance",
"AttributeOnAdd": "Callback method when adding elements",
"AttributeOnUpdate": "Callback method when updating elements",
"AttributeOnRemove": "Callback method when deleting elements"
},
"BootstrapBlazor.Server.Components.Samples.WinBoxes": {
"WinBoxTitle": "WinBox",
Expand Down
6 changes: 5 additions & 1 deletion src/BootstrapBlazor.Server/Locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -6803,7 +6803,11 @@
"SortableListSwapTitle": "交换",
"SortableListSwapIntro": "通过设置 <code>SortableListOption</code> 参数 <code>Swap</code> 设置拖拽项与目标项目交换",
"SortableListOnAddTitle": "多区域拖动",
"SortableListOnAddIntro": "通过设置 <code>SortableEvent</code> 参数 <code>FromId</code> 获得拖动项所属 <code>SortableList</code>。本示例中三个区域内元素可以任意拖动"
"SortableListOnAddIntro": "通过设置 <code>SortableEvent</code> 参数 <code>FromId</code> 获得拖动项所属 <code>SortableList</code>。本示例中三个区域内元素可以任意拖动",
"AttributeSortableListOption": "SortableListOption 实例",
"AttributeOnAdd": "增加元素时回调方法",
"AttributeOnUpdate": "更新元素时回调方法",
"AttributeOnRemove": "删除元素时回调方法"
},
"BootstrapBlazor.Server.Components.Samples.WinBoxes": {
"WinBoxTitle": "WinBox 窗口组件",
Expand Down

0 comments on commit 44da935

Please sign in to comment.