Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into feature/component/tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
teacher-zhou authored Dec 21, 2022
2 parents 78c1f0e + 65508ce commit 71834e3
Show file tree
Hide file tree
Showing 8 changed files with 364 additions and 9 deletions.
2 changes: 1 addition & 1 deletion doc/TDesign.Docs.Shared/App.razor
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</Found>
<NotFound>
<PageTitle>Not found</PageTitle>
<LayoutView TLayout="@typeof(MainLayout)">
<LayoutView Layout="@typeof(MainLayout)">
<p role="alert">Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
Expand Down
16 changes: 13 additions & 3 deletions doc/TDesign.Docs.Shared/Components/ComponentAPI.razor
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

@if (Parameters.Any())
{
<h3 style="font-weight: 700;font-size: 20px;line-height: 28px;margin: 48px 0 8px;display: flex;align-items: center;">@Title 的参数</h3>
<h3 style="font-weight: 700;font-size: 20px;line-height: 28px;margin: 48px 0 8px;display: flex;align-items: center;">@(GetTitle()) 的参数</h3>
<TTable TItem="Parameter" Data="Parameters">
<FieldColumn Value="context?.Name" Title="名称" AdditionalStyle="width:200px"></FieldColumn>
<FieldColumn Title="类型" >
Expand Down Expand Up @@ -68,7 +68,7 @@
};
Methods.Add(method);
}
<h3 style="font-weight: 700;font-size: 20px;line-height: 28px;margin: 48px 0 8px;display: flex;align-items: center;">@Title 的方法</h3>
<h3 style="font-weight: 700;font-size: 20px;line-height: 28px;margin: 48px 0 8px;display: flex;align-items: center;">@(GetTitle()) 的方法</h3>
<TTable TItem="Method" Data="Methods">
<FieldColumn Value="context?.Name" Title="名称" AdditionalStyle="width:200px"></FieldColumn>
<FieldColumn Value="context?.Parameter" Title="参数" AdditionalStyle="width:200px"></FieldColumn>
Expand All @@ -81,7 +81,7 @@
/// <summary>
/// 标题
/// </summary>
string? Title => TypeToCSharp(Component);
[Parameter]public string? Title{ get; set; }
/// <summary>
/// 参数
/// </summary>
Expand All @@ -96,6 +96,16 @@
[Parameter] public Type? Component { get; set; }
[Parameter] public string? Id { get; set; }


public string? GetTitle()
{
if (!string.IsNullOrEmpty(Title))
{
return Title;
}
return TypeToCSharp(Component);
}

/// <summary>
/// 参数列表模型
/// </summary>
Expand Down
3 changes: 2 additions & 1 deletion doc/TDesign.Docs.Shared/Layouts/NavMenu.razor
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
</TMenuItemGroup>
<TMenuItemGroup Title="导航">
<TMenuItem Link="components/affix">Affix 固钉</TMenuItem>
<TMenuItem Link="components/anchor">Anchor 锚点</TMenuItem>
<TMenuItem Link="components/breadcrumb">Breadcrum 面包屑</TMenuItem>
<TMenuItem Link="components/menu">Menu 导航菜单</TMenuItem>
<TMenuItem Link="components/pagination">Pagination 分页</TMenuItem>
<TMenuItem Link="components/step">Steps 步骤条</TMenuItem>
<TMenuItem Link="components/tab">Tabs 选项卡</TMenuItem>
<TMenuItem Link="components/anchor">Anchor 锚点</TMenuItem>
</TMenuItemGroup>
<TMenuItemGroup Title="输入">
<TMenuItem Link="components/form">Form 表单</TMenuItem>
Expand All @@ -32,6 +32,7 @@
<TMenuItem Link="components/inputnumber">InputNumber 数字输入框</TMenuItem>
<TMenuItem Link="components/radio">InputRadio 单选框</TMenuItem>
<TMenuItem Link="components/inputrange">RangeInput 范围输入框</TMenuItem>
<TMenuItem Link="components/select">Select 选择器</TMenuItem>
<TMenuItem Link="components/switch">Switch 开关</TMenuItem>
<TMenuItem Link="components/textarea">Textarea 多行文本框</TMenuItem>
</TMenuItemGroup>
Expand Down
176 changes: 176 additions & 0 deletions doc/TDesign.Docs.Shared/Pages/Components/SelectPage.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
@page "/components/select"
<PageHeader Title="Select 选择器">用于收纳大量选项的信息录入类组件。</PageHeader>
<HighlightAlert/>

<LayoutContent AnchorItems="@(new[]{"示例","禁用状态","不同尺寸的选择器","自定义下拉选项的选择器","API"})">

<Example Title="示例">
<Description></Description>
<RunContent>

<TSpace>
<TSpaceItem>

<TSelect @bind-Value="Value1">
<TSelectOption Value="1" Label="" />
<TSelectOption Value="2" Label="" />
</TSelect>
</TSpaceItem>
<TSpaceItem>

<TSelect @bind-Value="Value2">
<TSelectOption Value="@("云计算")" Label="云计算" />
<TSelectOption Value="@("RDS")" Label="RDS" />
<TSelectOption Value="@("云存储")" Label="云存储" Disabled/>
</TSelect>
</TSpaceItem>
</TSpace>


</RunContent>
<CodeContent>
@Code.Create(@"
```html
<TSelect bind-Value=""Value"">
<TSelectOption Value=""1"" Label=""""/>
<TSelectOption Value=""2"" Label=""""/>
</TSelect>

<TSelect bind-Value=""Value2"">
<TSelectOption Value=""云计算"" Label=""云计算"" />
<TSelectOption Value=""RDS"" Label=""RDS"" />
<TSelectOption Value=""云存储"" Label=""云存储"" Disabled/>
</TSelect>
```
")
</CodeContent>
</Example>

@code{
int Value1{ get; set; }
string Value2 { get; set; }
}

<Example Title="禁用状态">
<Description></Description>
<RunContent>

<TSelect @bind-Value="Value1" Disabled>
<TSelectOption Value="1" Label="" />
<TSelectOption Value="2" Label="" />
</TSelect>
</RunContent>
<CodeContent>
@Code.Create(@"
```html
<TSelect bind-Value=""Value"" Disabled>
<TSelectOption Value=""1"" Label=""""/>
<TSelectOption Value=""2"" Label=""""/>
</TSelect>
```
")
</CodeContent>
</Example>


<Example Title="不同尺寸的选择器">
<Description>提供大、中(默认)、小三种不同尺寸的的选择器。</Description>
<RunContent>
<TSpace>
<TSpaceItem>
<TSelect @bind-Value="Value1" Size="Size.Small">
<TSelectOption Value="1" Label="" />
<TSelectOption Value="2" Label="" />
</TSelect>
</TSpaceItem>
<TSpaceItem>
<TSelect @bind-Value="Value1">
<TSelectOption Value="1" Label="" />
<TSelectOption Value="2" Label="" />
</TSelect>
</TSpaceItem>
<TSpaceItem>
<TSelect @bind-Value="Value1" Size="Size.Large">
<TSelectOption Value="1" Label="" />
<TSelectOption Value="2" Label="" />
</TSelect>
</TSpaceItem>
</TSpace>
</RunContent>
<CodeContent>
@Code.Create(@"
```html
<TSelect bind-Value=""Value"" Size=""Size.Small"">
<TSelectOption Value=""1"" Label=""""/>
<TSelectOption Value=""2"" Label=""""/>
</TSelect>

<TSelect bind-Value=""Value"" Size=""Size.Small"">
<TSelectOption Value=""1"" Label=""""/>
<TSelectOption Value=""2"" Label=""""/>
</TSelect>

<TSelect bind-Value=""Value"" Size=""Size.Large"">
<TSelectOption Value=""1"" Label=""""/>
<TSelectOption Value=""2"" Label=""""/>
</TSelect>
```
")
</CodeContent>
</Example>

<Example Title="自定义下拉选项的选择器">
<Description></Description>
<RunContent>

<TSelect @bind-Value="Value1">
<TSelectOption Value="1" Label="" >
<div style="display:flex">
<TImage Src="avatar.jpg" AdditionalStyle="width:24px"/>
<div style="margin-left:16px">
</div>
</div>
</TSelectOption>
<TSelectOption Value="2" Label="" >

<div style="display:flex">
<TImage Src="avatar.jpg" AdditionalStyle="width:24px" />
<div style="margin-left:16px">
</div>
</div>
</TSelectOption>
</TSelect>
</RunContent>
<CodeContent>
@Code.Create(@"
```html
<TSelect bind-Value=""Value1"">
<TSelectOption Value=""1"" Label="""" >
<div style=""display:flex"">
<TImage Src=""avatar.jpg"" AdditionalStyle=""width:24px""/>
<div style=""margin-left:16px"">
</div>
</div>
</TSelectOption>
<TSelectOption Value=""2"" Label="""" >

<div style=""display:flex"">
<TImage Src=""avatar.jpg"" AdditionalStyle=""width:24px"" />
<div style=""margin-left:16px"">
</div>
</div>
</TSelectOption>
</TSelect>
```
")
</CodeContent>
</Example>
<div id="API"></div>
<ComponentAPI Title="TSelect" Component="typeof(TSelect<>)" />
<ComponentAPI Title="TSelectOption" Component="typeof(TSelectOption<>)" />

</LayoutContent>
23 changes: 23 additions & 0 deletions src/TDesign/Components/Forms/TSelect.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@namespace TDesign
@inherits BlazorInputComponentBase<TValue>
@typeparam TValue

<TPopup @ref="RefPopup" Trigger="PopupTrigger.Click" AdditionalStyle="position:absolute">
<ChildContent>
<div class="t-select__wrap">
<div class="@GetCssClassString()">
<TInputText @bind-Value="SelectedLabel" Readonly SuffixIcon="@(RefPopup.Visible?IconName.ChevronUp:IconName.ChevronDown)" AutoWidth="AutoWidth" Placeholder="@Placeholder" Disabled="Disabled" Size="Size"/>

</div>
</div>
</ChildContent>
<PopupContent>
<div class="t-select__dropdown-inner t-select__dropdown-inner--size-m">
<ul class="t-select__list">
<CascadingValue Value="this">
@ChildContent
</CascadingValue>
</ul>
</div>
</PopupContent>
</TPopup>
Loading

0 comments on commit 71834e3

Please sign in to comment.