docs: enhance documentation automation (#3013)

* Documentation automation. Build will generate documentation based on XML comments and attributes in the library. Translation will be done where necessary to generate the Chineese site.

Did some small code clean up on the way.
Removed or removed from public APIs:

AnchorLink.LinkDom
Button.RemoveAnimationAfter
Button.Icons - never used
Calendar.PrefixCls
All date pickers - method OnOkClick
Descriptions.Items
ListItem.PrefixName
AntList.PrefixName
ListItemMeta.PrefixName
Menu.Submenus
Menu.MenuItems
Transfer.ChildContent
Table.ColumnContext
Space.SetClass
Steps.Handler
Radio.OnClick

* Add Azure translation service. Requires adding your own key to a private appsettings JSON file to translate locally with it.

* Make translation services return null when unable to translate, have cache not cache it and return text asked to translate.

* Update documentation markdown file for new translation service

* Update DOCUMENTATION.md

* fix datepickerbase

* fix tree-select

* add docs for Flex and Watermark

* add zh

* add UserSecrets

* fix keywords

* fix button doc

* fix page

* fix internals visible to

---------

Co-authored-by: James Yeung <shunjiey@hotmail.com>
This commit is contained in:
Key Roche 2024-08-25 02:37:41 -04:00 коммит произвёл GitHub
Родитель 61ddc2a74a
Коммит 4ad8e7ceab
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
475 изменённых файлов: 11483 добавлений и 9014 удалений

6
.gitignore поставляемый
Просмотреть файл

@ -3,6 +3,9 @@
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# This file will contain settings we don't want committed to GIT
appsettings.private.json
# User-specific files
*.rsuser
*.suo
@ -360,3 +363,6 @@ site/AntDesign.Docs/wwwroot/color.less
.history
/components/LocalizedIntellisenseFiles/AntDesign.xml
components/LocalizedIntellisenseFiles/AntDesign.xml
# Documentation is automatically generated by XML comments now
site/AntDesign.Docs/Demos/Components/**/doc/**/*

Просмотреть файл

@ -36,6 +36,10 @@ EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AntDesign.Tests.Js", "tests\AntDesign.Tests.Js\AntDesign.Tests.Js.csproj", "{3C4ADCD5-6879-4478-9BA5-28C894AD52F3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AntDesign.Docs.Build", "site\AntDesign.Docs.Build\AntDesign.Docs.Build.csproj", "{67E9D6C5-106F-412C-B43C-F096145FD8A9}"
ProjectSection(ProjectDependencies) = postProject
{5A765767-0766-433D-B78D-97D8F29CA6A6} = {5A765767-0766-433D-B78D-97D8F29CA6A6}
{E2E6E4E8-2156-4B55-8164-40349D86330B} = {E2E6E4E8-2156-4B55-8164-40349D86330B}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AntDesign.TestApp", "AntDesign.TestApp", "{606789E3-AFE9-4489-9963-2B06A701D6B6}"
EndProject

144
DOCUMENTATION.md Normal file
Просмотреть файл

@ -0,0 +1,144 @@
# Documentation
The documentation on the website (www.antblazor.com) is automatically generated based on XML comments in the code files for the library. The idea is to keep the code and documentation site automatically in sync when changes are made. For this to be the case though, we must maintain the documentation comments in the code, using particular tags and formatting along with some data attributes. More details on this are given below.
For details on XML documentation comments in C# in general, see [the Microsoft website](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/xmldoc/).
## Documenting A Component
To mark a component to render a documentation page, tag it with the `Documentation` attribute, example:
`[Documentation(DocumentationCategory.Components, DocumentationType.DataDisplay, "https://fullUrl.com/to/image.jpg")]`
- The first argument is the category - choose from the enum
- The second argument is the type - choose from the enum
- The third argument is the image used for the "Overview" page
- There are many optional properties that can be set which affect the outcome of the page:
- `Title`- use a custom title for the page. This affects URL as well. Default is the component's class name.
- `Columns ` - the number of columns demos should be in. Default is 2.
- `Subtitle ` - sub title for the documentation page. Default is null.
- `OutputApi` - This one allows turning off outputting the decorated class's API. Default is true (output API).
- The primary use of this currently is for pages that group multiple components (such as the Typography page, Layout page, etc) and don't have their own main component. Choose a component that makes sense to decorate and put this option.
- Typically used in combination with the <seealso> tag in the XML comments of the component to output API of grouping components (see below for details on XML tags.
## Supported XML Tags
There are specific tags that the build project looks at the build the documentation of the website. There are a mixture of standard and custom tags we look for in the documentation comments.
- <summary> - The summary tag is used for the descriptions on most places of the site.
- For a component/page it is used at the block at the very top of the page (right below the title and above the demos).
- For class members, such as properties, parameters, fields, methods, etc, it is used to put a description next to the name of the member in the API section of the pages.
- <default value="something" /> - The default tag is a custom tag used to provide the default value of a member to the API section of the site.
- In the example above, `something` would display in the default column next to the member it is on
- Use of this is highly recommended even if the default is not directly set on the member itself, but is instead done through logic in the code itself.
- This can be short statements such as "if true, 1, else 0"
- No formatting is applied to these default values on the site
- <seealso cref="SomethingTheLibrary" /> - The see and seealso tags are used primarily to refer to other spots in the library and, when possible, link to those spots in the site.
- `see` is supported inside summary tags. When provided inside a summary, code style text will be inserted in that spot
- Types and members are supported here
- When a Type is used, we will attempt to put a link to the type's page on the site
- `seealso` is supported at the root level of components/page documentation.
- When provided here, API documentation for the member referenced in the `cref` will be added, in order, to the API section of the component's documentation page.
- Currently only types are supported here (ex: a class, not a property on a class)
- <para>Some text</para> - This tag will wrap text inside it in a paragraph when rendered in the site. This is supported inside summary tags and is recommended for use in the main summary of a component
- <list type="bullet">, <list type="number"> and <item> inside those tags. These are supported in summary tags and their use is recommended for the main summary of a component. This will cause a bulleted or numbered list to be rendered.
- <c> can be used in summary tags to indicate code and will be styled as such on the site.
- HTML header tags (<h1>, <h2>, etc) are supported inside summary tags. Their use is recommended for the main summary of a component
## Add FAQ section to documentation
FAQ sections can be added to documentation by placing markdown files in the proper spot, with the proper naming conventions.
- Place a file in the folder: `Demos/Components/[COMPONENT_NAME]/`
- Replacing `[COMPONENT_NAME]` with the name of the component the FAQ should go on the page for
- In the folder, name the file `faq.[LANG].md`
- Replacing `[LANG]` with the language code the file is in. Ex: `en-US`
- These files are not currently translated so each language must be provided.
## Miscellaneous
- `[Obsolete("Some short description on why and what else to use")]`
- Obsolete will display on the site with the message provided, along with a short message indicating it is to be removed in a future version.
- An Obsolete tag will display next to the description on the site
- Parameters will have a tag displayed next to them on the site indicating they are a component parameter.
- Things ignored and not put on the documentation:
- Injected services (using the `[Inject]` attribute) even if they have documentation comments
- Cascading parameters (using the `[CascadingParameter]` attribute) even if they have documentation comments
- Special members and constructors, regardless of documentation comments
- Methods ignored: (a full list can be seen in the `_methodNamesToIgnore` field in the `GenerateDemoJsonCommand`)
- Built-in methods such as `Dispose`, `Equals`, etc.
- Blazor lifecycle methods such as `OnAfterRender`, regardless of documentation comments
## Languages/Translations
All code documentation comments and messages are expected to be in English. Text is automatically translated from English to Chinese to generate the Chinese documentation where it makes sense.
<u>Translated</u>:
- Summary tags
- Obsolete messages
- Headers on API tables
<u>Not translated</u>:
- Markdown files (ex: for FAQ sections)
- Member/Class names
- Data types
- Default value text
- Method signatures, any part
### Override Translations
There may be cases when an automatic translation is insufficient or invalid. In these cases, there is the ability to specify the translation for <summary> tags by using a custom attribute on the tag. This is currently only supported for summary tags. If a translation is unable to be determined for any reason then the English will be used.
The example below demonstrates the usage:
```c#
/// <summary>
/// English summary
/// </summary>
/// <summary xml:lang="zh-CN">
/// Chinese summary
/// </summary>
public string SomeProperty { get; set; }
```
This property has English and Chinese summaries provided at once. By using the `xml:lang` attribute you can specify the language the summary is for. If the attribute is not provided then English is assumed.
### Translation Service
Documentation will be translated into Chinese with either Google or Azure.
- Azure: The default service used
- Requires providing an API key if you want it to run locally. Provide this key and the region for your key in the `appsettings.private.json` file in the Build.CLI folder. This file is gitignored so it will not be committed and reveal your key.
- Azure provides 2 million characters of translation per month for free. See details on [Microsoft's site](https://azure.microsoft.com/en-us/pricing/details/cognitive-services/translator/#pricing).
- Google: Not used unless a code change makes it used
- Available as a fallback option if desired
- Does not require an API key
- Very limited in number of requests that can be made. A single build of the docs will exceed this limit.
To avoid making excessive calls to either translation service, we cache the translations as "known translations" for later use (in the `KnownChineseTranslations.json` file)
<u>How it works</u>:
1. Translation requested
2. Check known translations - exists? Return the known translation. Doesn't exist? Continue.
3. Request translation
4. Add translation to list of known translations
5. At the end of the build, write known translations to disk
- This will exclude any un-used translations so we clean up removed text when we change something.

Просмотреть файл

@ -101,5 +101,7 @@
<ItemGroup>
<InternalsVisibleTo Include="AntDesign.Tests" />
<InternalsVisibleTo Include="AntDesign.Docs" />
<InternalsVisibleTo Include="AntDesign.Docs.Build.CLI" />
</ItemGroup>
</Project>

Просмотреть файл

@ -1,10 +1,26 @@
using System.Text.Json;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Text.Json;
using System.Threading.Tasks;
using AntDesign.JsInterop;
using Microsoft.AspNetCore.Components;
namespace AntDesign
{
/**
<summary>
<para>Wrap Affix around another component to make it stick the viewport.</para>
<h2>When To Use</h2>
<list type="bullet">
<item>On longer web pages, its helpful for some content to stick to the viewport. This is common for menus and actions.</item>
<item>Please note that Affix should not cover other content on the page, especially when the size of the viewport is small.</item>
</list>
<para><strong>Important</strong>: Children of <c>Affix</c> must not have the property <c>position: absolute</c>, but you can set <c>position: absolute</c> on <c>Affix</c> itself</para>
</summary>
*/
[Documentation(DocumentationCategory.Components, DocumentationType.Navigation, "https://gw.alipayobjects.com/zos/alicdn/tX6-md4H6/Affix.svg")]
public partial class Affix : AntDomComponentBase
{
private const string PrefixCls = "ant-affix";
@ -53,12 +69,22 @@ namespace AntDesign
[Parameter]
public int OffsetTop { get; set; }
/// <summary>
/// The CSS selector that specifies the scrollable area DOM node
/// </summary>
/// <default value="window" />
[Parameter]
public string TargetSelector { get; set; }
/// <summary>
/// Additional Content
/// </summary>
[Parameter]
public RenderFragment ChildContent { get; set; }
/// <summary>
/// Callback for when Affix state is changed. A boolean indicating if the Affix is currently affixed is passed.
/// </summary>
[Parameter]
public EventCallback<bool> OnChange { get; set; }

Просмотреть файл

@ -1,14 +1,23 @@
using System.Threading.Tasks;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Threading.Tasks;
using AntDesign.JsInterop;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using System.Collections.Generic;
namespace AntDesign
{
/// <summary>
/// Alert component for feedback.
/// <para>Alert component for feedback.</para>
/// <h2>When To Use</h2>
/// <list type="bullet">
/// <item>When you need to show alert messages to users.</item>
/// <item>When you need a persistent static container which is closable by user actions.</item>
/// </list>
/// </summary>
[Documentation(DocumentationCategory.Components, DocumentationType.Feedback, "https://gw.alipayobjects.com/zos/alicdn/8emPa3fjl/Alert.svg")]
public partial class Alert : AntDomComponentBase
{
/// <summary>
@ -20,12 +29,14 @@ namespace AntDesign
/// <summary>
/// Whether to show as banner
/// </summary>
/// <default value="false" />
[Parameter]
public bool Banner { get; set; } = false;
/// <summary>
/// Whether Alert can be closed
/// </summary>
/// <default value="false" />
[Parameter]
public bool Closable { get; set; } = false;

Просмотреть файл

@ -1,8 +1,10 @@
using System;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using AntDesign.JsInterop;
@ -11,6 +13,14 @@ using Microsoft.AspNetCore.Components.Web;
namespace AntDesign
{
/// <summary>
/// <para>Hyperlinks to scroll on one page.</para>
///
/// <h2>When To Use</h2>
/// <para>For displaying anchor hyperlinks on page and jumping between them.</para>
/// </summary>
/// <seealso cref="AnchorLink" />
[Documentation(DocumentationCategory.Components, DocumentationType.Other, "https://gw.alipayobjects.com/zos/alicdn/_1-C1JwsC/Anchor.svg")]
public partial class Anchor : AntDomComponentBase, IAnchor
{
private string _ballClass = "ant-anchor-ink-ball";
@ -56,18 +66,21 @@ namespace AntDesign
/// <summary>
/// Fixed mode of Anchor
/// </summary>
/// <default value="true" />
[Parameter]
public bool Affix { get; set; } = true;
/// <summary>
/// Bounding distance of anchor area
/// </summary>
/// <default value="5" />
[Parameter]
public int Bounds { get; set; } = 5;
/// <summary>
/// Scrolling container
/// </summary>
/// <default value="window" />
[Parameter]
public Func<string> GetContainer { get; set; } = () => "window";
@ -80,12 +93,14 @@ namespace AntDesign
/// <summary>
/// Pixels to offset from top when calculating position of scroll
/// </summary>
/// <default value="0" />
[Parameter]
public int? OffsetTop { get; set; } = 0;
/// <summary>
/// Whether show ink-balls in Fixed mode
/// </summary>
/// <default value="false" />
[Parameter]
public bool ShowInkInFixed { get; set; } = false;
@ -107,6 +122,9 @@ namespace AntDesign
[Parameter]
public int? TargetOffset { get; set; }
/// <summary>
/// Callback executed when the anchor changes, either by click or scrolling
/// </summary>
[Parameter]
public EventCallback<string> OnChange { get; set; }

Просмотреть файл

@ -1,17 +1,21 @@
using System;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using AntDesign.JsInterop;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using OneOf;
namespace AntDesign
{
/// <summary>
/// Link in an Anchor list. Designed to be a child of Anchor
/// </summary>
[DebuggerDisplay("Href: {Href}")]
public partial class AnchorLink : AntDomComponentBase, IAnchor
{
@ -21,7 +25,7 @@ namespace AntDesign
private bool _hrefDomExist;
private ClassMapper _titleClass = new ClassMapper();
private List<AnchorLink> _links = new List<AnchorLink>();
public DomRect LinkDom { get; private set; }
internal DomRect LinkDom { get; private set; }
#region Parameters
@ -42,17 +46,20 @@ namespace AntDesign
}
}
/// <summary>
/// Additional content. Does not override Title.
/// </summary>
[Parameter]
public RenderFragment ChildContent { get; set; }
/// <summary>
/// target of hyperlink
/// Target of hyperlink
/// </summary>
[Parameter]
public string Href { get; set; }
/// <summary>
/// content of hyperlink
/// Content of hyperlink
/// </summary>
[Parameter]
public string Title { get; set; }

Просмотреть файл

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
namespace AntDesign
{

Просмотреть файл

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
namespace AntDesign
{

Просмотреть файл

@ -1,4 +1,8 @@
using System;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
@ -12,43 +16,72 @@ using OneOf;
namespace AntDesign
{
/**
<summary>
<para>Autocomplete function of input field.</para>
<h2>When To Use</h2>
When there is a need for autocomplete functionality.
</summary>
<inheritdoc />
<seealso cref="AutoCompleteOption" />
<seealso cref="TriggerBoundaryAdjustMode"/>
*/
[Documentation(DocumentationCategory.Components, DocumentationType.DataEntry, "https://gw.alipayobjects.com/zos/alicdn/qtJm4yt45/AutoComplete.svg")]
public partial class AutoComplete<TOption> : AntInputComponentBase<string>, IAutoCompleteRef
{
#region Parameters
/// <summary>
/// Input element placeholder
/// </summary>
[Parameter]
public string Placeholder { get; set; }
/// <summary>
/// Disable
/// </summary>
[Parameter]
public bool Disabled { get; set; }
/// <summary>
/// Make first option active by default or not
/// </summary>
/// <default value="true" />
[Parameter]
public bool DefaultActiveFirstOption { get; set; } = true;
/// <summary>
/// Backfill selected item into the input when using keyboard to select items
/// </summary>
/// <default value="false" />
[Parameter]
public bool Backfill { get; set; } = false;
/// <summary>
/// Delays the processing of the KeyUp event until the user has stopped
/// typing for a predetermined amount of time
/// </summary>
/// <default value="250"/>
[Parameter]
public int DebounceMilliseconds { get; set; } = 250;
/// <summary>
/// 列表对象集合
/// List object collection
/// </summary>
private List<AutoCompleteOption> AutoCompleteOptions { get; set; } = new List<AutoCompleteOption>();
/// <summary>
/// 列表数据集合
/// List data collection
/// </summary>
private List<AutoCompleteDataItem<TOption>> _optionDataItems = new List<AutoCompleteDataItem<TOption>>();
/// <summary>
/// 列表绑定数据源集合
/// List bound data source collection
/// </summary>
private IEnumerable<TOption> _options;
/// <summary>
/// Options to display in dropdown
/// </summary>
[Parameter]
public IEnumerable<TOption> Options
{
@ -64,7 +97,6 @@ namespace AntDesign
}
/// <summary>
/// 绑定列表数据项格式的数据源
/// Bind the data source of the list data item format
/// </summary>
[Parameter]
@ -80,100 +112,124 @@ namespace AntDesign
}
}
/// <summary>
/// Callback executed when selection changes
/// </summary>
[Parameter]
public EventCallback<AutoCompleteOption> OnSelectionChange { get; set; }
/// <summary>
/// Callback executed when active item changes
/// </summary>
[Parameter]
public EventCallback<AutoCompleteOption> OnActiveChange { get; set; }
/// <summary>
/// Callback executed when input changes
/// </summary>
[Parameter]
public EventCallback<ChangeEventArgs> OnInput { get; set; }
/// <summary>
/// Callback executed when panel visibility changes
/// </summary>
[Parameter]
public EventCallback<bool> OnPanelVisibleChange { get; set; }
/// <summary>
/// Content for dropdown
/// </summary>
[Parameter]
public RenderFragment ChildContent { get; set; }
/// <summary>
/// 选项模板
/// Option template
/// </summary>
[Parameter]
public RenderFragment<AutoCompleteDataItem<TOption>> OptionTemplate { get; set; }
/// <summary>
/// 格式化选项,可以自定义显示格式
/// Formatting options, you can customize the display format
/// </summary>
[Parameter]
public Func<AutoCompleteDataItem<TOption>, string> OptionFormat { get; set; }
/// <summary>
/// 所有选项模板
/// All option templates
/// </summary>
[Parameter]
public RenderFragment OverlayTemplate { get; set; }
/// <summary>
/// 对比,用于两个对象比较是否相同
/// Contrast, used to compare whether two objects are the same
/// </summary>
[Parameter]
public Func<object, object, bool> CompareWith { get; set; } = (o1, o2) => o1?.ToString() == o2?.ToString();
/// <summary>
/// 过滤表达式
/// Filter expression
/// </summary>
[Parameter]
public Func<AutoCompleteDataItem<TOption>, string, bool> FilterExpression { get; set; } = (option, value) => string.IsNullOrEmpty(value) ? false : option.Label.Contains(value, StringComparison.InvariantCultureIgnoreCase);
/// <summary>
/// 允许过滤
/// Allow filtering
/// </summary>
/// <default value="true" />
[Parameter]
public bool AllowFilter { get; set; } = true;
/// <summary>
/// Width of input, pixels when an int is given, full value given to CSS width property when a string is given
/// </summary>
[Parameter]
public OneOf<int?, string> Width { get; set; }
/// <summary>
/// Class name passed to overlay
/// </summary>
[Parameter]
public string OverlayClassName { get; set; }
/// <summary>
/// Style passed to overlay
/// </summary>
[Parameter]
public string OverlayStyle { get; set; }
/// <summary>
/// Container selector for the popup
/// </summary>
/// <default value="body" />
[Parameter]
public string PopupContainerSelector { get; set; } = "body";
#endregion Parameters
//private ElementReference _divRef;
private OverlayTrigger _overlayTrigger;
public object SelectedValue { get; set; }
/// <summary>
/// 选择的项
/// Selected item from dropdown
/// </summary>
[Parameter]
public AutoCompleteOption SelectedItem { get; set; }
/// <summary>
/// 高亮的项目
/// Active item
/// </summary>
public object ActiveValue { get; set; }
/// <summary>
/// Overlay adjustment strategy (when for example browser resize is happening). Check
/// enum for details.
/// Overlay adjustment strategy (when for example browser resize is happening). Check
/// </summary>
/// <default value="TriggerBoundaryAdjustMode.InView"/>
[Parameter]
public TriggerBoundaryAdjustMode BoundaryAdjustMode { get; set; } = TriggerBoundaryAdjustMode.InView;
/// <summary>
/// Display options dropdown
/// </summary>
/// <default value="false" />
[Parameter]
public bool ShowPanel { get; set; } = false;
@ -289,7 +345,6 @@ namespace AntDesign
}
/// <summary>
/// 打开面板
/// Open panel
/// </summary>
public void OpenPanel()
@ -306,7 +361,6 @@ namespace AntDesign
}
/// <summary>
/// 关闭面板
/// Close panel
/// </summary>
public void ClosePanel()

Просмотреть файл

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;

Просмотреть файл

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.AspNetCore.Components;
using OneOf;
using Microsoft.AspNetCore.Components;
namespace AntDesign
{

Просмотреть файл

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Text;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
@ -10,12 +11,24 @@ namespace AntDesign
{
#region Parameters
/// <summary>
/// Label for the option. Takes priority over Label
/// </summary>
[Parameter]
public RenderFragment ChildContent { get; set; }
/// <summary>
/// Value for the option
/// </summary>
[Parameter]
public object Value { get; set; }
private string _label;
/// <summary>
/// Label for the option
/// </summary>
/// <default value="Value.ToString()" />
[Parameter]
public string Label
{
@ -23,11 +36,13 @@ namespace AntDesign
set { _label = value; }
}
/// <summary>
/// If option is disabled or not
/// </summary>
/// <default value="false" />
[Parameter]
public bool Disabled { get; set; } = false;
[Parameter]
[CascadingParameter]
public IAutoCompleteRef AutoComplete { get; set; }

Просмотреть файл

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;

Просмотреть файл

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components;
namespace AntDesign
{

Просмотреть файл

@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;

Просмотреть файл

@ -1,5 +1,8 @@
using System.Collections;
using System.Globalization;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections;
using System.Threading.Tasks;
using AntDesign.JsInterop;
using Microsoft.AspNetCore.Components;
@ -7,8 +10,15 @@ using Microsoft.AspNetCore.Components.Web;
namespace AntDesign
{
/// <summary>
/// <para>Avatars can be used to represent people or objects. It supports images, icons, or letters.</para>
/// </summary>
[Documentation(DocumentationCategory.Components, DocumentationType.DataDisplay, "https://gw.alipayobjects.com/zos/antfincdn/aBcnbw68hP/Avatar.svg")]
public partial class Avatar : AntDomComponentBase
{
/// <summary>
/// Content to display inside avatar shape. Takes priority over <see cref="Text"/>
/// </summary>
[Parameter]
public RenderFragment ChildContent
{
@ -20,9 +30,17 @@ namespace AntDesign
}
}
/// <summary>
/// Shape of the avatar
/// </summary>
/// <default value="AvatarShape.Circle"/>
[Parameter]
public string Shape { get; set; } = null;
/// <summary>
/// Size of the avatar. See <see cref="AntSizeLDSType"/> for possible values.
/// </summary>
/// <default value="default"/>
[Parameter]
public string Size
{
@ -37,6 +55,9 @@ namespace AntDesign
}
}
/// <summary>
/// Text string to display in the avatar. Typical use is for displaying initials.
/// </summary>
[Parameter]
public string Text
{
@ -51,18 +72,33 @@ namespace AntDesign
}
}
/// <summary>
/// Image src for the avatar. If this fails to load, <see cref="Icon"/> and <see cref="ChildContent"/>/<see cref="Text"/> will continue to show.
/// </summary>
[Parameter]
public string Src { get; set; }
/// <summary>
/// A list of sources to use for different screen resolutions. Passed straight to the <c>img</c> tag.
/// </summary>
[Parameter]
public string SrcSet { get; set; }
/// <summary>
/// Alternate text for the image
/// </summary>
[Parameter]
public string Alt { get; set; }
/// <summary>
/// Icon to display
/// </summary>
[Parameter]
public string Icon { get; set; }
/// <summary>
/// Callback executed when image passed to <see cref="Src"/> fails to load
/// </summary>
[Parameter]
public EventCallback<ErrorEventArgs> OnError { get; set; }

Просмотреть файл

@ -1,4 +1,8 @@
using System.Text.Json;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Text.Json;
using System.Threading.Tasks;
using AntDesign.JsInterop;
using Microsoft.AspNetCore.Components;
@ -6,23 +10,50 @@ using Microsoft.AspNetCore.Components.Web;
namespace AntDesign
{
/**
<summary>
<para>Makes it easy to go back to the top of the page.</para>
<h2>When To Use</h2>
<list type="bullet">
<item>When the page content is very long.</item>
<item>When you need to go back to the top very frequently in order to view the contents.</item>
</list>
</summary>
*/
[Documentation(DocumentationCategory.Components, DocumentationType.Other, "https://gw.alipayobjects.com/zos/alicdn/tJZ5jbTwX/BackTop.svg")]
public partial class BackTop : AntDomComponentBase
{
/// <summary>
/// Icon for the button
/// </summary>
/// <default value="vertical-align-top" />
[Parameter]
public string Icon { get; set; } = "vertical-align-top";
/// <summary>
/// Content for the button. Takes priority over icon.
/// </summary>
[Parameter]
public RenderFragment ChildContent { get; set; }
/// <summary>
/// Scroll offset at which the button becomes visible, in px
/// </summary>
/// <default value="400" />
[Parameter]
public double VisibilityHeight { get; set; } = 400;
/// <summary>
/// 回到顶部的目标控件
/// The scrollable area the button is for
/// </summary>
/// <default value="window" />
[Parameter]
public string TargetSelector { get; set; }
public string TargetSelector { get; set; } = "window";
/// <summary>
/// Callback executed when BackTop gets clicked. Won't override default functionality.
/// </summary>
[Parameter]
public EventCallback OnClick { get; set; }

Просмотреть файл

@ -9,9 +9,17 @@ using Microsoft.AspNetCore.Components;
namespace AntDesign
{
/// <summary>
/// Small numerical value or status descriptor for UI elements.
/// </summary>
/**
<summary>
<para>Small numerical value or status descriptor for UI elements.</para>
<h2>When To Use</h2>
<para>Badge normally appears in proximity to notifications or user avatars with eye-catching appeal, typically displaying unread messages count.</para>
</summary>
<seealso cref="AntDesign.BadgeRibbon" />
*/
[Documentation(DocumentationCategory.Components, DocumentationType.DataDisplay, "https://gw.alipayobjects.com/zos/antfincdn/6%26GF9WHwvY/Badge.svg")]
public partial class Badge : AntDomComponentBase
{
/// <summary>
@ -58,6 +66,7 @@ namespace AntDesign
/// <summary>
/// Whether to display a dot instead of count
/// </summary>
/// <default value="false"/>
[Parameter]
public bool Dot { get; set; }
@ -70,6 +79,7 @@ namespace AntDesign
/// <summary>
/// Max count to show
/// </summary>
/// <default value="99"/>
[Parameter]
public int OverflowCount
{
@ -93,6 +103,7 @@ namespace AntDesign
/// <summary>
/// Whether to show badge when count is zero
/// </summary>
/// <default value="false"/>
[Parameter]
public bool ShowZero { get; set; } = false;

Просмотреть файл

@ -1,5 +1,8 @@
using Microsoft.AspNetCore.Components;
using OneOf;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.AspNetCore.Components;
namespace AntDesign
{
@ -15,17 +18,21 @@ namespace AntDesign
public string Color { get; set; }
/// <summary>
/// Set text contents of ribbon.
/// Text string of ribbon.
/// </summary>
[Parameter]
public string Text { get; set; }
/// <summary>
/// Text content of the ribbon. Takes priority over <see cref="Text"/>
/// </summary>
[Parameter]
public RenderFragment TextTemplate { get; set; }
/// <summary>
/// Set placement of ribbon.
/// </summary>
/// <default value="end"/>
[Parameter]
public string Placement { get; set; } = "end";

Просмотреть файл

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace AntDesign
namespace AntDesign
{
public static class BadgeStatus
{

Просмотреть файл

@ -1,21 +1,47 @@
using System.Collections.Generic;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Routing;
namespace AntDesign
{
/**
<summary>
<para>A breadcrumb displays the current location within a hierarchy. It allows going back to states higher up in the hierarchy.</para>
When To Use
<list type="bullet">
<item>When the system has more than two layers in a hierarchy.</item>
<item>When you need to inform the user of where they are.</item>
<item>When the user may need to navigate back to a higher level.</item>
</list>
</summary>
<seealso cref="BreadcrumbItem" />
*/
[Documentation(DocumentationCategory.Components, DocumentationType.Navigation, "https://gw.alipayobjects.com/zos/alicdn/9Ltop8JwH/Breadcrumb.svg")]
public partial class Breadcrumb : AntDomComponentBase
{
/// <summary>
/// Content of the Breadcrumb. Should contain BreadcrumbItem elements
/// </summary>
[Parameter]
public RenderFragment ChildContent { get; set; }
/// <summary>
/// Not currently used. Planned for future development.
/// </summary>
/// <default value="false" />
[Parameter]
public bool AutoGenerate { get; set; } = false;
/// <summary>
/// Custom separator
/// Separator between items
/// </summary>
/// <default value="/" />
[Parameter]
public string Separator { get; set; } = "/";

Просмотреть файл

@ -2,47 +2,59 @@
@inherits AntDomComponentBase
<li @ref="Ref">
@if (Overlay != null)
{
<Dropdown Placement="@Placement.Bottom">
<Unbound>
<span @ref="context.Current" class="ant-breadcrumb-overlay-link">
@if (Overlay != null)
{
<Dropdown Placement="@Placement.Bottom">
<Unbound>
<span @ref="context.Current" class="ant-breadcrumb-overlay-link">
<span class="ant-breadcrumb-link" @onclick="@OnClick">
@FormattedChildContent
</span>
<Icon Type="down"></Icon>
</span>
</Unbound>
<Overlay>
@Overlay
</Overlay>
</Dropdown>
}
else
{
@FormattedChildContent
</span>
<Icon Type="down"></Icon>
</span>
</Unbound>
<Overlay>
@Overlay
</Overlay>
</Dropdown>
}
else
{
<span class="ant-breadcrumb-link" @onclick="@OnClick">
@FormattedChildContent
</span>
}
@FormattedChildContent
</span>
}
@if (BreadCrumb?.Separator != null)
{
<span class="ant-breadcrumb-separator">
@BreadCrumb.Separator
</span>
}
@if (BreadCrumb?.Separator != null)
{
<span class="ant-breadcrumb-separator">
@BreadCrumb.Separator
</span>
}
</li>
@code {
/// <summary>
/// Inner content of item
/// </summary>
[Parameter]
public RenderFragment ChildContent { get; set; }
/// <summary>
/// Overlay for a dropdown menu
/// </summary>
[Parameter]
public RenderFragment Overlay { get; set; }
/// <summary>
/// Link for the item. Providing this wraps the ChildContent in an anchor tag for this link.
/// </summary>
[Parameter]
public string Href { get; set; }
/// <summary>
/// Click callback
/// </summary>
[Parameter]
public EventCallback<MouseEventArgs> OnClick { get; set; }

Просмотреть файл

@ -2,17 +2,45 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
namespace AntDesign
{
/**
<summary>
<para>To trigger an operation.</para>
<h2>When To Use</h2>
<para>A button means an operation (or a series of operations). Clicking a button will trigger corresponding business logic.</para>
<para>In Ant Design we provide 4 types of button.</para>
<list type="bullet">
<item>Primary button: indicate the main action, one primary button at most in one section.</item>
<item>Default button: indicate a series of actions without priority.</item>
<item>Dashed button: used for adding action commonly.</item>
<item>Link button: used for external links.</item>
</list>
<para>And 4 other properties additionally.</para>
<list type="bullet">
<item><c>Danger</c>: used for actions of risk, like deletion or authorization.</item>
<item><c>Ghost</c>: used in situations with complex background, home pages usually.</item>
<item><c>Disabled</c>: when actions is not available.</item>
<item><c>Loading</c>: add loading spinner in button, avoiding multiple submits too.</item>
</list>
</summary>
<seealso cref="DownloadButton" />
*/
[Documentation(DocumentationCategory.Components, DocumentationType.General, "https://gw.alipayobjects.com/zos/alicdn/fNUKzY1sk/Button.svg")]
public partial class Button : AntDomComponentBase
{
private string _formSize;
public static readonly int RemoveAnimationAfter = 500;
private const int RemoveAnimationAfter = 500;
[CascadingParameter(Name = "FormSize")]
public string FormSize
@ -37,12 +65,14 @@ namespace AntDesign
/// <summary>
/// Set the color of the button.
/// </summary>
/// <default value="Color.None" />
[Parameter]
public Color Color { get; set; } = Color.None;
/// <summary>
/// Option to fit button width to its parent width
/// </summary>
/// <default value="false" />
[Parameter]
public bool Block { get; set; } = false;
@ -55,24 +85,28 @@ namespace AntDesign
/// <summary>
/// Set the danger status of button.
/// </summary>
/// <default value="false" />
[Parameter]
public bool Danger { get; set; }
/// <summary>
/// Whether the `Button` is disabled.
/// </summary>
/// <default value="false" />
[Parameter]
public bool Disabled { get; set; }
/// <summary>
/// Make background transparent and invert text and border colors
/// </summary>
/// <default value="false" />
[Parameter]
public bool Ghost { get; set; } = false;
public bool Ghost { get; set; }
/// <summary>
/// Set the original html type of the button element.
/// </summary>
/// <default value="button" />
[Parameter]
public string HtmlType { get; set; } = "button";
@ -85,6 +119,7 @@ namespace AntDesign
/// <summary>
/// Show loading indicator. You have to write the loading logic on your own.
/// </summary>
/// <default value="false" />
[Parameter]
public bool Loading { get; set; }
@ -103,18 +138,21 @@ namespace AntDesign
/// <summary>
/// Can set button shape: `circle` | `round` or `null` (default, which is rectangle).
/// </summary>
/// <default value="null" />
[Parameter]
public string Shape { get; set; } = null;
/// <summary>
/// Set the size of button.
/// </summary>
/// <default value="AntSizeLDSType.Default" />
[Parameter]
public string Size { get; set; } = AntSizeLDSType.Default;
/// <summary>
/// Type of the button.
/// </summary>
/// <default value="ButtonType.Default" />
[Parameter]
public string Type { get; set; } = ButtonType.Default;
@ -124,9 +162,6 @@ namespace AntDesign
[Parameter]
public bool NoSpanWrap { get; set; }
public IList<Icon> Icons { get; set; } = new List<Icon>();
private bool _animating = false;
private string _btnWave = "--antd-wave-shadow-color: rgb(255, 120, 117);";

Просмотреть файл

@ -8,7 +8,8 @@ namespace AntDesign
{
public partial class ButtonGroup : AntDomComponentBase
{
[Parameter] public RenderFragment ChildContent { get; set; }
[Parameter]
public RenderFragment ChildContent { get; set; }
private string _size;

Просмотреть файл

@ -10,11 +10,18 @@ using Microsoft.JSInterop;
namespace AntDesign
{
[Documentation(DocumentationCategory.Components, DocumentationType.General, null)]
public partial class DownloadButton : Button
{
/// <summary>
/// The download url of a file
/// </summary>
[Parameter]
public string Url { get; set; }
/// <summary>
/// Name of the file
/// </summary>
[Parameter]
public string FileName { get; set; }

Просмотреть файл

@ -1,4 +1,8 @@
using System;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Threading.Tasks;
@ -6,16 +10,33 @@ using Microsoft.AspNetCore.Components;
namespace AntDesign
{
/**
<summary>
<para>Container for displaying data in calendar form.</para>
<h2>When To Use</h2>
<para>When data is in the form of dates, such as schedules, timetables, prices calendar, lunar calendar. This component also supports Year/Month switch.</para>
</summary>
*/
[Documentation(DocumentationCategory.Components, DocumentationType.DataDisplay, "https://gw.alipayobjects.com/zos/antfincdn/dPQmLq08DI/Calendar.svg", Columns = 1)]
public partial class Calendar : AntDomComponentBase, IDatePicker
{
DateTime IDatePicker.CurrentDate { get; set; } = DateTime.Now;
DateTime? IDatePicker.HoverDateTime { get; set; }
/// <summary>
/// Selected value for calendar
/// </summary>
/// <default value="DateTime.Now"/>
[Parameter]
public DateTime Value { get; set; } = DateTime.Now;
private DateTime _defaultValue;
/// <summary>
/// Default value for selected date. When set, will set <see cref="Value"/>
/// </summary>
[Parameter]
public DateTime DefaultValue
{
@ -30,46 +51,90 @@ namespace AntDesign
}
}
/// <summary>
/// Validate range of dates or selection
/// </summary>
[Parameter]
public DateTime[] ValidRange { get; set; }
/// <summary>
/// Display mode. See <see cref="DatePickerType"/> for valid options
/// </summary>
/// <default value="DatePickerType.Month"/>
[Parameter]
public string Mode { get; set; } = DatePickerType.Month;
/// <summary>
/// Whether the calendar should take up all available space or not
/// </summary>
/// <default value="true"/>
[Parameter]
public bool FullScreen { get; set; } = true;
/// <summary>
/// Callback executed when a date is selected
/// </summary>
[Obsolete("Use OnChange instead")]
[Parameter]
public EventCallback<DateTime> OnSelect { get; set; }
/// <summary>
/// Callback executed when a date is selected
/// </summary>
[Parameter]
public EventCallback<DateTime> OnChange { get; set; }
/// <summary>
/// Function to render a custom header
/// </summary>
[Parameter]
public Func<CalendarHeaderRenderArgs, RenderFragment> HeaderRender { get; set; }
/// <summary>
/// Customize the display of the date cell, the returned content will be appended to the cell
/// </summary>
[Parameter]
public Func<DateTime, RenderFragment> DateCellRender { get; set; }
/// <summary>
/// Customize the display of the date cell, the returned content will override the cell
/// </summary>
[Parameter]
public Func<DateTime, RenderFragment> DateFullCellRender { get; set; }
/// <summary>
/// Customize the display of the month cell, the returned content will be appended to the cell
/// </summary>
[Parameter]
public Func<DateTime, RenderFragment> MonthCellRender { get; set; }
/// <summary>
/// Customize the display of the month cell, the returned content will override the cell
/// </summary>
[Parameter]
public Func<DateTime, RenderFragment> MonthFullCellRender { get; set; }
/// <summary>
/// Callback executed when the type of calendar being viewed changes
/// </summary>
[Parameter]
public Action<DateTime, string> OnPanelChange { get; set; }
/// <summary>
/// Function to determine if a specific date is disabled
/// </summary>
[Parameter]
public Func<DateTime, bool> DisabledDate { get; set; } = null;
/// <summary>
/// Locale information for UI and date formatting
/// </summary>
[Parameter]
public DatePickerLocale Locale { get; set; } = LocaleProvider.CurrentLocale.DatePicker;
/// <summary>
/// Culture information used for formatting
/// </summary>
[Parameter]
public CultureInfo CultureInfo { get; set; } = LocaleProvider.CurrentLocale.CurrentCulture;
@ -77,7 +142,7 @@ namespace AntDesign
protected readonly DateTime[] PickerValues = new DateTime[] { DateTime.Now, DateTime.Now };
protected Stack<string> _prePickerStack = new Stack<string>();
public readonly string PrefixCls = "ant-picker-calendar";
internal readonly string PrefixCls = "ant-picker-calendar";
event EventHandler<bool> IDatePicker.OverlayVisibleChanged
{

Просмотреть файл

@ -8,51 +8,113 @@ using Microsoft.AspNetCore.Components;
namespace AntDesign
{
/**
<summary>
<para>Simple rectangular container.</para>
<h2>When To Use</h2>
<list type="bullet">
<item>A card can be used to display content related to a single subject. The content can consist of multiple elements of varying types and sizes.</item>
</list>
</summary>
<seealso cref="CardGrid"/>
<seealso cref="CardMeta"/>
*/
[Documentation(DocumentationCategory.Components, DocumentationType.DataDisplay, "https://gw.alipayobjects.com/zos/antfincdn/NqXt8DJhky/Card.svg", Columns = 1)]
public partial class Card : AntDomComponentBase
{
/// <summary>
/// Content for the card's body. Shown below <see cref="Body"/>
/// </summary>
[Parameter]
public RenderFragment ChildContent { get; set; }
/// <summary>
/// Content for the card's body. Shown above <see cref="ChildContent"/>
/// </summary>
[Obsolete("Use ChildContent instead")]
[Parameter]
public RenderFragment Body { get; set; }
/// <summary>
/// Content to put in the actions section of the card. Takes priority over <see cref="Actions"/>
/// </summary>
[Parameter]
public RenderFragment ActionTemplate { get; set; }
/// <summary>
/// Toggles rendering of the border around the card
/// </summary>
/// <default value="true" />
[Parameter]
public bool Bordered { get; set; } = true;
/// <summary>
/// Make card hoverable
/// </summary>
/// <default value="false" />
[Parameter]
public bool Hoverable { get; set; } = false;
/// <summary>
/// Shows a loading indicator while the contents of the card are being fetched
/// </summary>
/// <default value="false" />
[Parameter]
public bool Loading { get; set; } = false;
/// <summary>
/// Style string for body section
/// </summary>
[Parameter]
public string BodyStyle { get; set; }
/// <summary>
/// Cover content for card. Displayed below header and above body
/// </summary>
[Parameter]
public RenderFragment Cover { get; set; }
/// <summary>
/// Actions for the card
/// </summary>
[Parameter]
public IList<RenderFragment> Actions { get; set; } = new List<RenderFragment>();
/// <summary>
/// Card style type, can be set to inner or not set
/// </summary>
[Parameter]
public string Type { get; set; }
/// <summary>
/// Size of the card
/// </summary>
[Parameter]
public string Size { get; set; }
/// <summary>
/// Title string for header
/// </summary>
[Parameter]
public string Title { get; set; }
/// <summary>
/// Title content for header. Takes priority over <see cref="Title"/>
/// </summary>
[Parameter]
public RenderFragment TitleTemplate { get; set; }
/// <summary>
/// Content to render in the top-right corner of the card
/// </summary>
[Parameter]
public RenderFragment Extra { get; set; }
/// <summary>
/// Tab content rendered below title
/// </summary>
[Parameter]
public RenderFragment CardTabs { get; set; }

Просмотреть файл

@ -1,15 +1,18 @@
using System;
using System.Collections.Generic;
using System.Text;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.AspNetCore.Components;
namespace AntDesign
{
public partial class CardAction : AntDomComponentBase
{
[CascadingParameter] private Card Card { get; set; }
[CascadingParameter]
private Card Card { get; set; }
[Parameter] public RenderFragment ChildContent { get; set; }
[Parameter]
public RenderFragment ChildContent { get; set; }
protected override void OnInitialized()
{

Просмотреть файл

@ -1,15 +1,23 @@
using System;
using System.Collections.Generic;
using System.Text;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.AspNetCore.Components;
namespace AntDesign
{
public partial class CardGrid : AntDomComponentBase
{
/// <summary>
/// Content for that section of the grid
/// </summary>
[Parameter]
public RenderFragment ChildContent { get; set; }
/// <summary>
/// If the section should be hoverable. Adds dropshadow and lifts up when hovered if true.
/// </summary>
/// <default value="false"/>
[Parameter]
public bool Hoverable { get; set; }

Просмотреть файл

@ -47,21 +47,39 @@
@code{
/// <summary>
/// Title string
/// </summary>
[Parameter]
public string Title { get; set; }
/// <summary>
/// Title content. Takes priority over <see cref="Title"/>
/// </summary>
[Parameter]
public RenderFragment TitleTemplate { get; set; }
/// <summary>
/// Description string
/// </summary>
[Parameter]
public string Description { get; set; }
/// <summary>
/// Description content. Takes priority over <see cref="Description"/>
/// </summary>
[Parameter]
public RenderFragment DescriptionTemplate { get; set; }
/// <summary>
/// Avatar string. Will be passed to <see cref="AntDesign.Avatar"/> component's <see cref="AntDesign.Avatar.Src"/>
/// </summary>
[Parameter]
public string Avatar { get; set; }
/// <summary>
/// Avatar content. Takes priority over <see cref="Avatar"/>
/// </summary>
[Parameter]
public RenderFragment AvatarTemplate { get; set; }

Просмотреть файл

@ -1,4 +1,8 @@
using System;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Text.Json;
using System.Threading;
@ -8,6 +12,21 @@ using Microsoft.AspNetCore.Components;
namespace AntDesign
{
/**
<summary>
<para>A carousel component. Scales with its container.</para>
<h2>When To Use</h2>
<list type="bullet">
<item>When there is a group of content on the same level.</item>
<item>When there is insufficient content space, it can be used to save space in the form of a revolving door.</item>
<item>Commonly used for a group of pictures/cards.</item>
</list>
</summary>
<seealso cref="CarouselSlick"/>
*/
[Documentation(DocumentationCategory.Components, DocumentationType.DataDisplay, "https://gw.alipayobjects.com/zos/antfincdn/%24C9tmj978R/Carousel.svg")]
public partial class Carousel : AntDomComponentBase
{
private const string PrefixCls = "ant-carousel";
@ -51,6 +70,9 @@ namespace AntDesign
#region Parameters
/// <summary>
/// Content of the carousel. Typically <see cref="CarouselSlick"/> elements
/// </summary>
[Parameter]
public RenderFragment ChildContent { get; set; }
@ -80,7 +102,8 @@ namespace AntDesign
#endregion Parameters
[Inject] public IDomEventListener DomEventListener { get; set; }
[Inject]
public IDomEventListener DomEventListener { get; set; }
public void Next() => GoTo(_slicks.IndexOf(ActiveSlick) + 1);

Просмотреть файл

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AntDesign
namespace AntDesign
{
public static class CarouselDotPosition
{

Просмотреть файл

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AntDesign
namespace AntDesign
{
public static class CarouselEffect
{

Просмотреть файл

@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.AspNetCore.Components;
namespace AntDesign
@ -27,11 +25,15 @@ namespace AntDesign
}
}
}
#region Parameters
[CascadingParameter]
internal Carousel Parent { get; set; }
/// <summary>
/// Content to display when on this part of the carousel
/// </summary>
[Parameter]
public RenderFragment ChildContent { get; set; }

Просмотреть файл

@ -1,47 +1,124 @@
using System;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Components;
using System.Linq;
using System.Threading.Tasks;
using AntDesign.JsInterop;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.JSInterop;
using AntDesign.JsInterop;
namespace AntDesign
{
/**
<summary>
<para>Cascade selection box.</para>
<h2>When To Use</h2>
<list type="bullet">
<item>When you need to select from a set of associated data set. Such as province/city/district, company level, things classification.</item>
<item>When selecting from a large data set, with multi-stage classification separated for easy selection.</item>
<item>Chooses cascade items in one float layer for better user experience.</item>
</list>
</summary>
<seealso cref="CascaderNode"/>
<seealso cref="TriggerBoundaryAdjustMode"/>
*/
[Documentation(DocumentationCategory.Components, DocumentationType.DataEntry, "https://gw.alipayobjects.com/zos/alicdn/UdS8y8xyZ/Cascader.svg")]
public partial class Cascader : AntInputComponentBase<string>
{
[Parameter] public bool AllowClear { get; set; } = true;
/// <summary>
/// Whether to allow clearing or not
/// </summary>
/// <summary xml:lang="zh-CN">
/// 是否允许清算
/// </summary>
/// <default value="true" />
[Parameter]
public bool AllowClear { get; set; } = true;
/// <summary>
/// Overlay adjustment strategy (when for example browser resize is happening)
/// </summary>
[Parameter] public TriggerBoundaryAdjustMode BoundaryAdjustMode { get; set; } = TriggerBoundaryAdjustMode.InView;
[Parameter] public bool ChangeOnSelect { get; set; }
[Parameter] public string DefaultValue { get; set; }
[Parameter] public string ExpandTrigger { get; set; }
[Parameter] public string NotFoundContent { get; set; } = LocaleProvider.CurrentLocale.Empty.Description;
[Parameter] public string Placeholder { get => _placeHolder; set => _placeHolder = value; }
[Parameter] public string PopupContainerSelector { get; set; } = "body";
[Parameter] public bool ShowSearch { get; set; }
[Parameter] public bool Disabled { get; set; }
[Parameter]
public TriggerBoundaryAdjustMode BoundaryAdjustMode { get; set; } = TriggerBoundaryAdjustMode.InView;
/// <summary>
/// Please use SelectedNodesChanged instead.
/// Change value on each selection if set to true, only chage on final selection if false.
/// </summary>
[Parameter]
public bool ChangeOnSelect { get; set; }
/// <summary>
/// Initially selected value
/// </summary>
[Parameter]
public string DefaultValue { get; set; }
/// <summary>
/// When to expand the current item - click or hover
/// </summary>
/// <default value="click" />
[Parameter]
public string ExpandTrigger { get; set; }
/// <summary>
/// Empty description for when not found
/// </summary>
/// <default value="No Data (in current locale)" />
[Parameter]
public string NotFoundContent { get; set; } = LocaleProvider.CurrentLocale.Empty.Description;
/// <summary>
/// Placeholder for input
/// </summary>
/// <default value="Please select (in current locacle)" />
[Parameter]
public string Placeholder
{
get => _placeHolder;
set => _placeHolder = value;
}
/// <summary>
/// Element to show popup container in
/// </summary>
/// <deault value="body"/>
[Parameter]
public string PopupContainerSelector { get; set; } = "body";
/// <summary>
/// Allow searching or not
/// </summary>
[Parameter]
public bool ShowSearch { get; set; }
/// <summary>
/// Disable input or not
/// </summary>
[Parameter]
public bool Disabled { get; set; }
/// <summary>
/// Callback executed when the selected value changes
/// </summary>
[Obsolete("Instead use SelectedNodesChanged.")]
[Parameter] public Action<List<CascaderNode>, string, string> OnChange { get; set; }
[Parameter]
public Action<List<CascaderNode>, string, string> OnChange { get; set; }
[Parameter] public EventCallback<CascaderNode[]> SelectedNodesChanged { get; set; }
/// <summary>
/// Callback executed when the selected value changes
/// </summary>
[Parameter]
public EventCallback<CascaderNode[]> SelectedNodesChanged { get; set; }
/// <summary>
/// Options for the overlay
/// </summary>
[Parameter]
public IEnumerable<CascaderNode> Options
{
@ -69,13 +146,13 @@ namespace AntDesign
private List<CascaderNode> _selectedNodes = new List<CascaderNode>();
private List<CascaderNode> _hoverSelectedNodes = new List<CascaderNode>();
private List<CascaderNode> _renderNodes = new List<CascaderNode>();
private List<CascaderNode> _searchList = new List<CascaderNode>();
private readonly List<CascaderNode> _searchList = new List<CascaderNode>();
private IEnumerable<CascaderNode> _matchList;
private ClassMapper _menuClassMapper = new ClassMapper();
private ClassMapper _inputClassMapper = new ClassMapper();
private readonly ClassMapper _menuClassMapper = new ClassMapper();
private readonly ClassMapper _inputClassMapper = new ClassMapper();
private EventCallbackFactory _callbackFactory = new EventCallbackFactory();
private readonly EventCallbackFactory _callbackFactory = new EventCallbackFactory();
private bool _dropdownOpened;
private bool _isOnCascader;
@ -326,6 +403,7 @@ namespace AntDesign
/// <param name="list"></param>
/// <param name="parentNode"></param>
/// <param name="level"></param>
/// <param name="recursive"></param>
private void InitCascaderNodeState(List<CascaderNode> list, CascaderNode parentNode, int level, bool recursive = false)
{
if (list == null) return;

Просмотреть файл

@ -5,10 +5,20 @@ namespace AntDesign
{
public class CascaderNode
{
/// <summary>
/// Label displayed for value
/// </summary>
public string Label { get; set; }
/// <summary>
/// Value for when option is selected
/// </summary>
public string Value { get; set; }
/// <summary>
/// Disable the option or not
/// </summary>
/// <default value="false" />
public bool Disabled { get; set; }
internal int Level { get; set; }
@ -17,6 +27,9 @@ namespace AntDesign
internal bool HasChildren { get { return Children?.Any() == true; } }
/// <summary>
/// Options under this one
/// </summary>
public IEnumerable<CascaderNode> Children { get; set; }
}

Просмотреть файл

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace AntDesign
namespace AntDesign
{
public class CheckboxOption<TValue>
{

Просмотреть файл

@ -1,4 +1,8 @@
using System;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Linq.Expressions;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
@ -8,20 +12,54 @@ using System.Linq;
namespace AntDesign
{
/**
<summary>
<para>Checkbox component.</para>
<h2>When To Use</h2>
<list type="bullet">
<item>Used for selecting multiple values from several options.</item>
<item>If you use only one checkbox, it is the same as using Switch to toggle between two states. </item>
</list>
<para>The difference is that Switch will trigger the state change directly, but Checkbox just marks the state as changed and this needs to be submitted.</para>
</summary>
<seealso cref="CheckboxGroup"/>
*/
[Documentation(DocumentationCategory.Components, DocumentationType.DataEntry, "https://gw.alipayobjects.com/zos/alicdn/8nbVbHEm_/CheckBox.svg")]
public partial class Checkbox : AntInputBoolComponentBase
{
[Parameter] public RenderFragment ChildContent { get; set; }
/// <summary>
/// Content to display next to checkbox
/// </summary>
[Parameter]
public RenderFragment ChildContent { get; set; }
//[Obsolete] attribute does not work with [Parameter] for now. Tracking issue: https://github.com/dotnet/aspnetcore/issues/30967
[Obsolete("Instead use @bing-Checked or EventCallback<bool> CheckedChanged .")]
/// <summary>
/// Callback executed when checked state changes
/// </summary>
//[Obsolete] attribute does not work with [Parameter] for now. Tracking issue: https://github.com/dotnet/razor/issues/7657
[Obsolete("Instead use @bind-Checked or EventCallback<bool> CheckedChanged .")]
[Parameter]
public EventCallback<bool> CheckedChange { get; set; }
[Parameter] public Expression<Func<bool>> CheckedExpression { get; set; }
[Obsolete("Currently not implemented")]
[Parameter]
public Expression<Func<bool>> CheckedExpression { get; set; }
[Parameter] public bool Indeterminate { get; set; }
/// <summary>
/// Indeterminate checked state of checkbox
/// </summary>
[Parameter]
public bool Indeterminate { get; set; }
[Parameter] public string Label { get; set; }
/// <summary>
/// Label for checkbox
/// </summary>
[Parameter]
public string Label { get; set; }
[CascadingParameter] private ICheckboxGroup CheckboxGroup { get; set; }

Просмотреть файл

@ -7,15 +7,24 @@ using OneOf;
namespace AntDesign
{
/// <summary>
/// Display a group of related checkboxes
/// </summary>
#if NET6_0_OR_GREATER
[CascadingTypeParameter(nameof(TValue))]
#endif
public partial class CheckboxGroup<TValue> : AntInputComponentBase<TValue[]>, ICheckboxGroup
{
/// <summary>
/// Display content in the group. Use <see cref="MixedMode"/> to specify where this should render if using with <see cref="Options"/>
/// </summary>
[Parameter]
public RenderFragment ChildContent { get; set; }
/// <summary>
/// Options for checkboxes
/// </summary>
[Parameter]
public OneOf<CheckboxOption<TValue>[], TValue[]> Options
{
@ -31,6 +40,10 @@ namespace AntDesign
}
}
/// <summary>
/// When both <see cref="ChildContent"/> and <see cref="Options"/> are used this specifies which should render first.
/// </summary>
/// <default value="CheckboxGroupMixedMode.ChildContentFirst"/>
[Parameter]
public CheckboxGroupMixedMode MixedMode
{
@ -48,9 +61,16 @@ namespace AntDesign
}
}
/// <summary>
/// Callback executed when the checked options change
/// </summary>
[Parameter]
public EventCallback<TValue[]> OnChange { get; set; }
/// <summary>
/// Disable all checkboxes in the group
/// </summary>
/// <default value="false" />
[Parameter]
public bool Disabled { get; set; }

Просмотреть файл

@ -1,34 +1,76 @@
using System;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using OneOf;
namespace AntDesign
{
/**
<summary>
<para>A content area which can be collapsed and expanded.</para>
<h2>When To Use</h2>
<list type="bullet">
<item>Can be used to group or hide complex regions to keep the page clean.</item>
<item><c>Accordion</c> is a special kind of <c>Collapse</c>, which allows only one panel to be expanded at a time.</item>
</list>
</summary>
<seealso cref="Panel"/>
*/
[Documentation(DocumentationCategory.Components, DocumentationType.DataDisplay, "https://gw.alipayobjects.com/zos/alicdn/IxH16B9RD/Collapse.svg", Columns = 1)]
public partial class Collapse : AntDomComponentBase
{
#region Parameter
/// <summary>
/// Enable/disable accordion mode. When true, only one panel can be open at once. When opening another the rest collapse.
/// </summary>
/// <default value="false"/>
[Parameter]
public bool Accordion { get; set; }
/// <summary>
/// Enable/disable border
/// </summary>
/// <default value="true"/>
[Parameter]
public bool Bordered { get; set; } = true;
/// <summary>
/// Expand icon position
/// </summary>
/// <default value="CollapseExpandIconPosition.Left"/>
[Parameter]
public string ExpandIconPosition { get; set; } = CollapseExpandIconPosition.Left;
/// <summary>
/// Default <see cref="Panel"/> element's <see cref="Panel.Key"/>
/// </summary>
[Parameter]
public string[] DefaultActiveKey { get; set; } = Array.Empty<string>();
/// <summary>
/// Callback executed when open panels change
/// </summary>
[Parameter]
public EventCallback<string[]> OnChange { get; set; }
/// <summary>
/// Icon to display in <see cref="ExpandIconPosition"/>
/// </summary>
/// <default value="right"/>
[Parameter]
public string ExpandIcon { get; set; } = "right";
/// <summary>
/// Expand icon content to display in <see cref="ExpandIconPosition"/>. Takes priority over <see cref="ExpandIcon"/>
/// </summary>
[Parameter]
public RenderFragment<bool> ExpandIconTemplate { get; set; }
@ -42,6 +84,9 @@ namespace AntDesign
#endregion Parameter
/// <summary>
/// Content of the collapse. Typically contains <see cref="Panel"/> elements
/// </summary>
[Parameter]
public RenderFragment ChildContent { get; set; }

Просмотреть файл

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace AntDesign
namespace AntDesign
{
public static class CollapseExpandIconPosition
{

Просмотреть файл

@ -1,40 +1,71 @@
using System;
using System.Threading.Tasks;
using System.Threading.Tasks;
using AntDesign.JsInterop;
using Microsoft.AspNetCore.Components;
using OneOf;
namespace AntDesign
{
public partial class Panel : AntDomComponentBase
{
/// <summary>
/// If the panel is active or not
/// </summary>
/// <default value="false"/>
[Parameter]
public bool Active { get; set; }
/// <summary>
/// Unique identifier for the panel
/// </summary>
[Parameter]
public string Key { get; set; }
/// <summary>
/// If true, the panel cannot be opened or closed.
/// </summary>
/// <default value="false" />
[Parameter]
public bool Disabled { get; set; }
/// <summary>
/// Display an arrow or not for the panel
/// </summary>
/// <default value="true" />
[Parameter]
public bool ShowArrow { get; set; } = true;
/// <summary>
/// Extra string for the corner of the panel
/// </summary>
[Parameter]
public string Extra { get; set; }
/// <summary>
/// Extra content for the corner of the panel. Takes priority over <see cref="Extra"/>
/// </summary>
[Parameter]
public RenderFragment ExtraTemplate { get; set; }
/// <summary>
/// Header string for the panel
/// </summary>
[Parameter]
public string Header { get; set; }
/// <summary>
/// Header content for the panel. Takes priority over <see cref="Header"/>
/// </summary>
[Parameter]
public RenderFragment HeaderTemplate { get; set; }
/// <summary>
/// Callback executed when this panel's active status changes
/// </summary>
[Parameter]
public EventCallback<bool> OnActiveChange { get; set; }
/// <summary>
/// Content for the panel.
/// </summary>
[Parameter]
public RenderFragment ChildContent { get; set; }

Просмотреть файл

@ -14,7 +14,6 @@
else
{
<Avatar Src="@Avatar" />
}
</div>
<div class="ant-comment-content">

Просмотреть файл

@ -1,41 +1,82 @@
using System;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using OneOf;
namespace AntDesign
{
/**
<summary>
<para>A comment displays user feedback and discussion to website content.</para>
<h2>When To Use</h2>
<para>Comments can be used to enable discussions on an entity such as a page, blog post, issue or other.</para>
</summary>
*/
[Documentation(DocumentationCategory.Components, DocumentationType.DataDisplay, "https://gw.alipayobjects.com/zos/alicdn/ILhxpGzBO/Comment.svg", Columns = 1)]
public partial class Comment : AntDomComponentBase
{
/// <summary>
/// Author string
/// </summary>
[Parameter]
public string Author { get; set; }
/// <summary>
/// Author content. Takes priority over <see cref="Author"/>
/// </summary>
[Parameter]
public RenderFragment AuthorTemplate { get; set; }
/// <summary>
/// Avatar string. Gets passed as the <see cref="Avatar.Src"/> to the <see cref="AntDesign.Avatar"/> component.
/// </summary>
[Parameter]
public string Avatar { get; set; }
/// <summary>
/// Avatar content. Takes priority over <see cref="Avatar"/>
/// </summary>
[Parameter]
public RenderFragment AvatarTemplate { get; set; }
/// <summary>
/// Content string for the comment
/// </summary>
[Parameter]
public string Content { get; set; }
/// <summary>
/// Content for the comment. Takes priority over <see cref="Content"/>
/// </summary>
[Parameter]
public RenderFragment ContentTemplate { get; set; }
/// <summary>
/// Used primarily for nesting comments for functionality such as replies
/// </summary>
[Parameter]
public RenderFragment ChildContent { get; set; }
/// <summary>
/// Date string for the comment
/// </summary>
[Parameter]
public string Datetime { get; set; }
/// <summary>
/// Date content for the comment. Takes priority over <see cref="Datetime"/>
/// </summary>
[Parameter]
public RenderFragment DatetimeTemplate { get; set; }
/// <summary>
/// List of actions to show at the bottm of the comment
/// </summary>
[Parameter]
public IList<RenderFragment> Actions { get; set; } = new List<RenderFragment>();

Просмотреть файл

@ -1,4 +1,8 @@
using System.Threading.Tasks;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
namespace AntDesign
@ -36,9 +40,11 @@ namespace AntDesign
[Parameter]
public FormConfig Form { get; set; }
[Parameter] public RenderFragment ChildContent { get; set; }
[Parameter]
public RenderFragment ChildContent { get; set; }
[Inject] private ConfigService ConfigService { get; set; }
[Inject]
private ConfigService ConfigService { get; set; }
private string _direction;

Просмотреть файл

@ -1,5 +1,4 @@
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.CompilerServices;
using Microsoft.AspNetCore.Components.Rendering;
namespace AntDesign

Просмотреть файл

@ -7,6 +7,10 @@ namespace AntDesign
[Inject]
private IComponentIdGenerator ComponentIdGenerator { get; set; }
/// <summary>
/// ID for the component's HTML
/// </summary>
/// <default value="Uniquely Generated ID" />
[Parameter]
public string Id { get; set; }
@ -15,9 +19,6 @@ namespace AntDesign
protected bool RTL => ConfigProvider?.Direction == "RTL";
//[Parameter(CaptureUnmatchedValues = true)]
//public Dictionary<string, object> Attributes { get; set; } = new Dictionary<string, object>();
private ElementReference _ref;
/// <summary>
@ -73,7 +74,6 @@ namespace AntDesign
{
_style += ";";
}
//this.StateHasChanged();
}
}

Просмотреть файл

@ -1,4 +1,7 @@
using System.Collections.Generic;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
@ -6,9 +9,19 @@ namespace AntDesign
{
public abstract class AntInputBoolComponentBase : AntInputComponentBase<bool>
{
[Parameter] public bool AutoFocus { get; set; }
/// <summary>
/// Whether to autofocus on the input or not
/// </summary>
/// <default value="false" />
[Parameter]
public bool AutoFocus { get; set; }
private bool _checked;
/// <summary>
/// If the input is checked or not
/// </summary>
/// <default value="false"/>
[Parameter]
public bool Checked
{
@ -23,6 +36,9 @@ namespace AntDesign
}
}
/// <summary>
/// Callback executed when the input changes
/// </summary>
[Parameter]
public EventCallback<bool> OnChange { get; set; }
@ -32,6 +48,10 @@ namespace AntDesign
[Parameter]
public virtual EventCallback<bool> CheckedChanged { get; set; }
/// <summary>
/// Disable the input
/// </summary>
/// <default value="false"/>
[Parameter]
public bool Disabled { get; set; }

Просмотреть файл

@ -52,6 +52,9 @@ namespace AntDesign
protected IForm Form => FormItem?.Form;
/// <summary>
/// Validation messages for the FormItem
/// </summary>
public string[] ValidationMessages { get; private set; } = Array.Empty<string>();
private string _formSize;
@ -100,17 +103,20 @@ namespace AntDesign
}
/// <summary>
/// Gets or sets a callback that updates the bound value.
/// Callback that updates the bound value.
/// </summary>
[Parameter]
public virtual EventCallback<TValue> ValueChanged { get; set; }
/// <summary>
/// Gets or sets an expression that identifies the bound value.
/// An expression that identifies the bound value.
/// </summary>
[Parameter]
public Expression<Func<TValue>> ValueExpression { get; set; }
/// <summary>
/// An expression that identifies the enumerable of bound values.
/// </summary>
[Parameter]
public Expression<Func<IEnumerable<TValue>>> ValuesExpression { get; set; }
@ -118,6 +124,7 @@ namespace AntDesign
/// The size of the input box. Note: in the context of a form,
/// the `large` size is used. Available: `large` `default` `small`
/// </summary>
/// <default value="AntSizeLDSType.Default"/>
[Parameter]
public string Size { get; set; } = AntSizeLDSType.Default;
@ -125,6 +132,7 @@ namespace AntDesign
/// What Culture will be used when converting string to value and value to string
/// Useful for InputNumber component.
/// </summary>
/// <default value="CultureInfo.CurrentCulture"/>
[Parameter]
public virtual CultureInfo CultureInfo { get; set; } = CultureInfo.CurrentCulture;

Просмотреть файл

@ -6,9 +6,11 @@
@ChildContent
}
@code{
@code
{
[Parameter]
public RenderFragment ChildContent { get; set; }
[Parameter] public RenderFragment ChildContent { get; set; }
[Parameter] public Func<bool> If { get; set; }
[Parameter]
public Func<bool> If { get; set; }
}

Просмотреть файл

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components;
namespace AntDesign
{

Просмотреть файл

@ -3,8 +3,6 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Text;
namespace AntDesign
{

Просмотреть файл

@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
namespace AntDesign
{
/// <summary>

Просмотреть файл

@ -1,4 +1,8 @@
using System.Collections.Generic;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Rendering;
using Microsoft.AspNetCore.Components.Web;
@ -7,11 +11,14 @@ namespace AntDesign.Internal
{
public class Element : AntDomComponentBase
{
[Parameter] public string HtmlTag { get; set; }
[Parameter]
public string HtmlTag { get; set; }
[Parameter] public RenderFragment ChildContent { get; set; }
[Parameter]
public RenderFragment ChildContent { get; set; }
[Parameter] public EventCallback<ElementReference> RefChanged { get; set; }
[Parameter]
public EventCallback<ElementReference> RefChanged { get; set; }
[Parameter(CaptureUnmatchedValues = true)]
public Dictionary<string, object> Attributes { get; set; } = new Dictionary<string, object>();

Просмотреть файл

@ -1,4 +1,8 @@
using System;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Linq;
using System.Text.Json;
using System.Threading.Tasks;
@ -34,6 +38,7 @@ namespace AntDesign.Internal
/// Overlay adjustment strategy (when for example browser resize is happening). Check
/// enum for details.
/// </summary>
/// <default value="TriggerBoundaryAdjustMode.InView" />
[Parameter]
public TriggerBoundaryAdjustMode BoundaryAdjustMode { get; set; } = TriggerBoundaryAdjustMode.InView;
@ -47,12 +52,14 @@ namespace AntDesign.Internal
/// 自动关闭功能和Visible参数同时生效
/// Both auto-off and Visible control close
/// </summary>
/// <default value="false" />
[Parameter]
public bool ComplexAutoCloseAndVisible { get; set; } = false;
/// <summary>
/// Whether the trigger is disabled.
/// </summary>
/// <default value="false" />
[Parameter]
public bool Disabled { get; set; }
@ -60,12 +67,14 @@ namespace AntDesign.Internal
/// Property forwarded to Overlay component. Consult the Overlay
/// property for more detailed explanation.
/// </summary>
/// <default value="false" />
[Parameter]
public bool HiddenMode { get; set; } = false;
/// <summary>
/// (not used in Unbound) Sets wrapping div style to `display: inline-flex;`.
/// </summary>
/// <default value="false" />
[Parameter]
public bool InlineFlexMode { get; set; } = false;
@ -73,6 +82,7 @@ namespace AntDesign.Internal
/// Behave like a button: when clicked invoke OnClick
/// (unless OnClickDiv is overriden and does not call base).
/// </summary>
/// <default value="false" />
[Parameter]
public bool IsButton { get; set; } = false;
@ -161,6 +171,11 @@ namespace AntDesign.Internal
*/
private PlacementType _paramPlacement = PlacementType.BottomLeft;
/// <summary>
/// The position of the Dropdown overlay relative to the target.
/// Can be: Top, Left, Right, Bottom, TopLeft, TopRight, BottomLeft, BottomRight, LeftTop, LeftBottom, RightTop, RightBottom
/// </summary>
/// <default value="PlacementType.BottomLeft" />
[Parameter]
public Placement Placement
{
@ -188,12 +203,14 @@ namespace AntDesign.Internal
/// Example use case: when overlay has to be contained in a
/// scrollable area.
/// </summary>
/// <default value="body" />
[Parameter]
public string PopupContainerSelector { get; set; } = "body";
/// <summary>
/// Trigger mode. Could be multiple by passing an array.
/// </summary>
/// <default value="TriggerType.Hover" />
[Parameter]
public Trigger[] Trigger //TODO: this should probably be a flag not an array
{
@ -204,6 +221,9 @@ namespace AntDesign.Internal
}
}
/// <summary>
///
/// </summary>
[Parameter]
public string TriggerCls { get; set; }
@ -228,6 +248,7 @@ namespace AntDesign.Internal
/// <summary>
/// Toggles overlay viability.
/// </summary>
/// <default value="false" />
[Parameter]
public bool Visible { get; set; } = false;

Просмотреть файл

@ -3,12 +3,11 @@
public enum TriggerBoundaryAdjustMode
{
/// <summary>
/// 不自动调整
/// do not auto adjust
/// Do not auto adjust
/// </summary>
None,
/// <summary>
/// 在可视范围内(默认模式)
/// The default, the viewport boundaries are the boundaries that are used for calculation if overlay
/// is fully visible.
/// Attempt to fit the overlay so it is always fully visible in the viewport.
@ -16,12 +15,12 @@
/// to be attempted.
/// </summary>
InView,
/// <summary>
/// 在滚动范围内
/// The document boundaries are the boundaries used for calculation if overlay needs to be reposition.
/// So even if the overlay is outside of the viewport, the overlay may still be shown as long as it
/// does not "overflow" the document boundaries.
/// </summary>
InScroll,
InScroll
}
}

Просмотреть файл

@ -2,9 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using AntDesign.Core.JsInterop.ObservableApi;
using AntDesign.JsInterop;
@ -15,11 +13,14 @@ namespace AntDesign.Core.Component.ResizeObserver
{
public partial class ResizeObserver : AntComponentBase
{
[Parameter] public RenderFragment ChildContent { get; set; }
[Parameter]
public RenderFragment ChildContent { get; set; }
[Parameter] public EventCallback<DomRect> OnResize { get; set; }
[Parameter]
public EventCallback<DomRect> OnResize { get; set; }
[Inject] public DomEventService DomEventService { get; set; }
[Inject]
public DomEventService DomEventService { get; set; }
private IDomEventListener _domEventListener;

Просмотреть файл

@ -1,10 +1,23 @@
namespace AntDesign
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
namespace AntDesign
{
public class FormValidateErrorMessages
{
private static string _typeTemplate = "'{0}' is not a valid {1}";
private static readonly string _typeTemplate = "'{0}' is not a valid {1}";
/// <summary>
/// Default generic validation error message
/// </summary>
public string Default { get; set; } = "Validation error on field '{0}'";
/// <summary>
/// Default validation message for the Required rule
/// </summary>
public string Required { get; set; } = "'{0}' is required";
public string Enum { get; set; } = "'{0}' must be one of [{1}]";
public string Whitespace { get; set; } = "'{0}' cannot be empty";
@ -16,6 +29,9 @@
Invalid = "'{0}' is an invalid date",
};
/// <summary>
/// Messages for when a field's type does not match the expected type
/// </summary>
public TypesMessage Types { get; set; } = new()
{
String = _typeTemplate,
@ -31,6 +47,9 @@
Url = _typeTemplate,
};
/// <summary>
/// Messages for string type
/// </summary>
public CompareMessage String { get; set; } = new()
{
Len = "'{0}' must be exactly {1} characters",
@ -39,6 +58,9 @@
Range = "'{0}' must be between {1} and {2} characters",
};
/// <summary>
/// Messages for string type
/// </summary>
public CompareMessage Number { get; set; } = new()
{
Len = "'{0}' must equal {1}",
@ -47,6 +69,9 @@
Range = "'{0}' must be between {1} and {2}",
};
/// <summary>
/// Messages for array type
/// </summary>
public CompareMessage Array { get; set; } = new()
{
Len = "'{0}' must be exactly {1} in length",
@ -55,6 +80,9 @@
Range = "'{0}' must be between {1} and {2} in length",
};
/// <summary>
/// Messages for the Pattern validation rule
/// </summary>
public PatternMessage Pattern { get; set; } = new()
{
Mismatch = "'{0}' does not match pattern {1}",

Просмотреть файл

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace AntDesign
namespace AntDesign
{
public enum AntDirectionVHIType
{

Просмотреть файл

@ -2,10 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Text;
namespace AntDesign
{
public class DirectionVHType : EnumValue<DirectionVHType>

Просмотреть файл

@ -0,0 +1,27 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
namespace AntDesign
{
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
internal class DocumentationAttribute : Attribute
{
public DocumentationAttribute(DocumentationCategory category, DocumentationType type, string coverImageUrl)
{
Category = category;
Type = type;
CoverImageUrl = coverImageUrl;
}
public DocumentationCategory Category { get; }
public int Columns { get; set; } = 2;
public string CoverImageUrl { get; }
public bool OutputApi { get; set; } = true;
public string? SubTitle { get; set; } = null;
public string Title { get; set; } = null;
public DocumentationType Type { get; }
}
}

Просмотреть файл

@ -0,0 +1,14 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.ComponentModel;
namespace AntDesign
{
public enum DocumentationCategory
{
[Description("Components")]
Components
}
}

Просмотреть файл

@ -0,0 +1,35 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.ComponentModel;
namespace AntDesign
{
public enum DocumentationType
{
[Description("Feedback")]
Feedback,
[Description("Data Display")]
DataDisplay,
[Description("Navigation")]
Navigation,
[Description("Data Entry")]
DataEntry,
[Description("General")]
General,
[Description("Layout")]
Layout,
[Description("Overview")]
Overview,
[Description("Other")]
Other,
}
}

Просмотреть файл

@ -2,10 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace AntDesign.Core.Extensions
{

Просмотреть файл

@ -2,9 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.AspNetCore.Components;
namespace AntDesign.Core.Extensions

Просмотреть файл

@ -3,9 +3,6 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;

Просмотреть файл

@ -3,8 +3,6 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace AntDesign

Просмотреть файл

@ -3,8 +3,6 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace AntDesign

Просмотреть файл

@ -3,8 +3,6 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace AntDesign

Просмотреть файл

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.AspNetCore.Components.Forms;
namespace AntDesign.Forms
namespace AntDesign.Forms
{
public interface IControlValueAccessor
{

Просмотреть файл

@ -1,7 +1,5 @@
using Microsoft.AspNetCore.Components;
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.Generic;
using Microsoft.AspNetCore.Components;
namespace AntDesign
{

Просмотреть файл

@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.Generic;
namespace AntDesign
{

Просмотреть файл

@ -1,7 +1,6 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Net.Sockets;
namespace AntDesign.JsInterop
{

Просмотреть файл

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace AntDesign.core.JsInterop.EventArg
namespace AntDesign.core.JsInterop.EventArg
{
public class MouseEvent
{

Просмотреть файл

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
namespace AntDesign.JsInterop
{

Просмотреть файл

@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;

Просмотреть файл

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace AntDesign
namespace AntDesign
{
public class SortDirection : EnumValue<SortDirection>
{

Просмотреть файл

@ -1,4 +1,8 @@
using System;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Threading.Tasks;
using AntDesign.Core.Extensions;
using AntDesign.Internal;
@ -7,8 +11,27 @@ using Microsoft.AspNetCore.Components.Web;
namespace AntDesign
{
/**
<summary>
<para>To select or input a date.</para>
<h2>When To Use</h2>
<para>By clicking the input box, you can select a date from a popup calendar.</para>
</summary>
<seealso cref="MonthPicker{TValue}"/>
<seealso cref="RangePicker{TValue}"/>
<seealso cref="WeekPicker{TValue}"/>
<seealso cref="YearPicker{TValue}"/>
<seealso cref="QuarterPicker{TValue}"/>
<seealso cref="TriggerBoundaryAdjustMode"/>
*/
[Documentation(DocumentationCategory.Components, DocumentationType.DataEntry, "https://gw.alipayobjects.com/zos/alicdn/RT_USzA48/DatePicker.svg")]
public partial class DatePicker<TValue> : DatePickerBase<TValue>
{
/// <summary>
/// Callback executed when the selected value changes
/// </summary>
[Parameter]
public EventCallback<DateTimeChangedEventArgs<TValue>> OnChange { get; set; }

Просмотреть файл

@ -63,6 +63,9 @@ namespace AntDesign
private readonly DateTime[] _pickerValuesAfterInit = new DateTime[2];
/// <summary>
/// Callback executed when range selected changes
/// </summary>
[Parameter]
public EventCallback<DateRangeChangedEventArgs<TValue>> OnChange { get; set; }

Просмотреть файл

@ -1,4 +1,8 @@
using System;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
@ -54,6 +58,9 @@ namespace AntDesign
}
}
/// <summary>
/// Set picker type
/// </summary>
[Parameter]
public string Picker
{
@ -66,9 +73,17 @@ namespace AntDesign
}
}
/// <summary>
/// Selector for placing the container of the popup in
/// </summary>
[Parameter]
public string PopupContainerSelector { get; set; }
/// <summary>
/// Disable the date picker.
/// When given a single boolean, it will disable all of it.
/// When given an array of booleans, it represents disabling the start/end of a range: [start, end]
/// </summary>
[Parameter]
public OneOf<bool, bool[]> Disabled { get; set; } = new bool[] { false, false };
@ -78,21 +93,45 @@ namespace AntDesign
[Parameter]
public TriggerBoundaryAdjustMode BoundaryAdjustMode { get; set; } = TriggerBoundaryAdjustMode.InView;
/// <summary>
/// Show a border or not
/// </summary>
/// <default value="true"/>
[Parameter]
public bool Bordered { get; set; } = true;
/// <summary>
/// Autofocus on the input or not
/// </summary>
/// <default value="false"/>
[Parameter]
public bool AutoFocus { get; set; } = false;
/// <summary>
/// If the picker is open or not
/// </summary>
/// <default value="false" />
[Parameter]
public bool Open { get; set; }
/// <summary>
/// If the picker is read-only or not
/// </summary>
/// <default value="false"/>
[Parameter]
public bool InputReadOnly { get; set; } = false;
/// <summary>
/// Whether to show the Today button which selects Today from any date
/// </summary>
/// <default value="true"/>
[Parameter]
public bool ShowToday { get; set; } = true;
/// <summary>
/// Locale for localizing UI strings
/// </summary>
/// <default value="LocaleProvider.CurrentLocale.DatePicker" />
[Parameter]
public string Mask { get; set; }
@ -107,6 +146,10 @@ namespace AntDesign
}
}
/// <summary>
/// CultureInfo to use for localization
/// </summary>
/// <default value="CultureInfo for Locale"/>
[Parameter]
public override CultureInfo CultureInfo
{
@ -130,12 +173,25 @@ namespace AntDesign
}
}
/// <summary>
/// If time should be shown or not. Contains the boolean decision made from setting <see cref="ShowTime" />
/// </summary>
public bool IsShowTime { get; protected set; }
/// <summary>
/// Time format when showing time. Contains the string format from setting <see cref="ShowTime" /> with a string
/// </summary>
public string ShowTimeFormat { get; protected set; }
protected OneOf<bool, string> _showTime = null;
private bool _timeFormatProvided;
/// <summary>
/// Show time or not.
/// <para>When boolean, it sets ShowTime to the boolean.</para>
/// <para>When string, it sets ShowTime to true and uses the string value as the time format.</para>
/// </summary>
[Parameter]
public OneOf<bool, string> ShowTime
{
@ -156,12 +212,19 @@ namespace AntDesign
}
}
/// <summary>
/// Allow clearing the selected value or not
/// </summary>
/// <default value="true"/>
[Parameter]
public bool AllowClear { get; set; } = true;
protected string[] _placeholders = new string[] { "", "" };
protected OneOf<string, string[]> _placeholder;
/// <summary>
/// Placeholder for input
/// </summary>
[Parameter]
public OneOf<string, string[]> Placeholder
{
@ -180,20 +243,35 @@ namespace AntDesign
}
}
/// <summary>
/// Style applied to popup
/// </summary>
[Parameter]
public string PopupStyle { get; set; }
/// <summary>
/// Picker class name
/// </summary>
[Parameter]
public string ClassName { get; set; }
/// <summary>
/// Class name for popover dropdown
/// </summary>
[Parameter]
public string DropdownClassName { get; set; }
/// <summary>
/// Format for the DateTime display
/// </summary>
[Parameter]
public string Format { get; set; }
private TValue _defaultValue;
/// <summary>
/// Default value
/// </summary>
[Parameter]
public TValue DefaultValue
{
@ -204,6 +282,9 @@ namespace AntDesign
protected bool[] UseDefaultPickerValue { get; } = new bool[2];
private TValue _defaultPickerValue;
/// <summary>
/// Default value of the picker
/// </summary>
[Parameter]
public TValue DefaultPickerValue
{
@ -211,68 +292,120 @@ namespace AntDesign
set => _defaultPickerValue = SortValue(value);
}
/// <summary>
/// Custom suffix icon
/// </summary>
[Parameter]
public RenderFragment SuffixIcon { get; set; }
/// <summary>
/// Range selection presets to allow the user to select a range with one button click
/// </summary>
[Parameter]
public Dictionary<string, DateTime?[]> Ranges { get; set; } = new Dictionary<string, DateTime?[]>();
/// <summary>
/// Extra content to display in picker footer
/// </summary>
[Parameter]
public RenderFragment RenderExtraFooter { get; set; }
[Obsolete]
/// <summary>
/// Callback executed when clear is clicked
/// </summary>
[Obsolete("Use OnClear instead")]
[Parameter]
public EventCallback OnClearClick { get; set; }
/// <summary>
/// Called when clear button clicked.
/// Called when clear button clicked.
/// </summary>
[Parameter]
public EventCallback OnClear { get; set; }
/// <summary>
/// Callback executed when ok is clicked
/// </summary>
[Parameter]
public EventCallback OnOk { get; set; }
/// <summary>
/// Callback executed when popover calendar is opened or closed
/// </summary>
[Parameter]
public EventCallback<bool> OnOpenChange { get; set; }
/// <summary>
/// Callback executed when the type of panel displayed changes
/// </summary>
[Parameter]
public EventCallback<DateTimeChangedEventArgs<TValue>> OnPanelChange { get; set; }
/// <summary>
/// Function to determine if a provided date should be disabled
/// </summary>
[Parameter]
public virtual Func<DateTime, bool> DisabledDate { get; set; } = null;
/// <summary>
/// Function to determine if a hours in a date should be disabled
/// </summary>
[Parameter]
public Func<DateTime, int[]> DisabledHours { get; set; } = null;
/// <summary>
/// Function to determine if a minutes in a date should be disabled
/// </summary>
[Parameter]
public Func<DateTime, int[]> DisabledMinutes { get; set; } = null;
/// <summary>
/// Function to determine if a seconds in a date should be disabled
/// </summary>
[Parameter]
public Func<DateTime, int[]> DisabledSeconds { get; set; } = null;
/// <summary>
/// Function to determine what pieces of time should be disabled in a date
/// </summary>
[Parameter]
public Func<DateTime, DatePickerDisabledTime> DisabledTime { get; set; } = null;
/// <summary>
/// Custom rendering for date cells
/// </summary>
[Parameter]
public Func<DateTime, DateTime, RenderFragment> DateRender { get; set; }
/// <summary>
/// Custom rendering for month cells
/// </summary>
// TODO: need locale
[Parameter]
public Func<DateTime, RenderFragment> MonthCellRender { get; set; }
[Parameter]
public bool Use12Hours { get; set; }
/// <summary>
/// The position where the selection box pops up
/// </summary>
[Parameter] public Placement Placement { get; set; } = Placement.BottomLeft;
/// <summary>
/// When true, will use 12 hour time. When false will use 24 hour time
/// </summary>
/// <default value="false" />
[Parameter]
public bool Use12Hours { get; set; }
/// <summary>
/// Date used for "Today"
/// </summary>
public DateTime CurrentDate { get; set; } = DateTime.Today;
protected DateTime[] PickerValues { get; } = { DateTime.Today, DateTime.Today };
/// <summary>
/// If picker is a range picker or not
/// </summary>
public bool IsRange { get; protected set; }
protected DatePickerInput _inputStart;
@ -282,8 +415,7 @@ namespace AntDesign
protected string _activeBarStyle = "";
protected string _rangeArrowStyle = "";
internal DatePickerStatus[] _pickerStatus
= new DatePickerStatus[] { new DatePickerStatus(), new DatePickerStatus() };
internal DatePickerStatus[] _pickerStatus = new DatePickerStatus[] { new DatePickerStatus(), new DatePickerStatus() };
protected Stack<string> _prePickerStack = new Stack<string>();
protected bool _isClose = true;
@ -594,7 +726,7 @@ namespace AntDesign
SetDisabledTime();
}
public async Task OnOkClick()
internal async Task OnOkClick()
{
var index = GetOnFocusPickerIndex();
@ -721,12 +853,20 @@ namespace AntDesign
return disabled;
}
/// <summary>
/// Close the popover
/// </summary>
public void Close()
{
_duringManualInput = false;
_dropDown?.Hide();
}
/// <summary>
/// Add focus to picker
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
public async Task Focus(int index = 0)
{
DatePickerInput input = null;
@ -748,6 +888,11 @@ namespace AntDesign
}
}
/// <summary>
/// Remove focus from picker
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
public async Task Blur(int index = 0)
{
DatePickerInput input = null;
@ -769,6 +914,10 @@ namespace AntDesign
}
}
/// <summary>
/// Get index of picker which is currently focused
/// </summary>
/// <returns>Index of picker. 0 can also mean neither is focused.</returns>
public int GetOnFocusPickerIndex()
{
if (_inputStart != null && _inputStart.IsOnFocused)
@ -977,15 +1126,25 @@ namespace AntDesign
}
/// <summary>
/// 修改值
/// Change the value of the given picker panel
/// </summary>
/// <param name="value"></param>
/// <param name="index"></param>
/// <param name="closeDropdown"></param>
/// <param name="value">Value to change to</param>
/// <param name="index">Index of the picker panel to change</param>
/// <param name="closeDropdown">Close the panel when set or not</param>
public abstract void ChangeValue(DateTime value, int index = 0, bool closeDropdown = true);
/// <summary>
/// Clear the value for the given picker panel index
/// </summary>
/// <param name="index">Index of the picker panel to clear</param>
/// <param name="closeDropdown">Close the panel when cleared or not</param>
public abstract void ClearValue(int index = 0, bool closeDropdown = true);
/// <summary>
/// Get value of picker panel at index
/// </summary>
/// <param name="index">Index of picker panel to get value of</param>
/// <returns>DateTime value of panel</returns>
public abstract DateTime? GetIndexValue(int index);
protected TValue SortValue(TValue value)

Просмотреть файл

@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.AspNetCore.Components;
namespace AntDesign.Internal

Просмотреть файл

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace AntDesign
namespace AntDesign
{
public static class DatePickerSize
{

Просмотреть файл

@ -1,8 +1,9 @@
using System;
using System.Collections;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AntDesign.JsInterop;
using Microsoft.AspNetCore.Components;
@ -10,27 +11,56 @@ using OneOf;
namespace AntDesign
{
using ColumnType = OneOf<int, Dictionary<string, int>>;
/**
<summary>
<para>Display multiple read-only fields in groups.</para>
<h2>When To Use</h2>
<para>Commonly displayed on the details page.</para>
</summary>
<seealso cref="DescriptionsItem"/>
*/
[Documentation(DocumentationCategory.Components, DocumentationType.DataDisplay, "https://gw.alipayobjects.com/zos/alicdn/MjtG9_FOI/Descriptions.svg", Columns = 1)]
public partial class Descriptions : AntDomComponentBase
{
#region Parameters
/// <summary>
/// Whether to display the border
/// </summary>
/// <default value="false"/>
[Parameter]
public bool Bordered { get; set; } = false;
/// <summary>
/// Layout - Horizontal or Vertical
/// </summary>
/// <default value="DescriptionsLayout.Horizontal"/>
[Parameter]
public string Layout { get; set; } = DescriptionsLayout.Horizontal;
/// <summary>
/// The number of <see cref="DescriptionsItem"/> elements in a row. Could be a number or a object like { xs: 8, sm: 16, md: 24}
/// </summary>
[Parameter]
public ColumnType Column { get; set; }
public OneOf<int, Dictionary<string, int>> Column { get; set; }
/// <summary>
/// Size of the list
/// </summary>
[Parameter]
public string Size { get; set; }
/// <summary>
/// Title shown at the top of the element
/// </summary>
[Parameter]
public string Title { get; set; }
/// <summary>
/// Title content shown at the top of the element. Takes priority over <see cref="Title"/>
/// </summary>
[Parameter]
public RenderFragment TitleTemplate { get; set; }
@ -39,10 +69,13 @@ namespace AntDesign
#endregion Parameters
/// <summary>
/// Content for the element. Typically contains <see cref="DescriptionsItem"/> elements
/// </summary>
[Parameter]
public RenderFragment ChildContent { get; set; }
public IList<IDescriptionsItem> Items { get; } = new List<IDescriptionsItem>();
internal IList<IDescriptionsItem> Items { get; } = new List<IDescriptionsItem>();
private List<List<(IDescriptionsItem item, int realSpan)>> _itemMatrix = new List<List<(IDescriptionsItem item, int realSpan)>>();

Просмотреть файл

@ -1,23 +1,35 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.AspNetCore.Components;
using OneOf;
namespace AntDesign
{
public partial class DescriptionsItem : AntDomComponentBase, IDescriptionsItem
{
/// <summary>
/// Title for the item
/// </summary>
[Parameter]
public string Title { get; set; } = "";
public string Title { get; set; } = string.Empty;
/// <summary>
/// Title content for the item. Takes priority over <see cref="Title"/>
/// </summary>
[Parameter]
public RenderFragment TitleTemplate { get; set; }
/// <summary>
/// Span of the item
/// </summary>
/// <default value="1"/>
[Parameter]
public int Span { get; set; } = 1;
/// <summary>
/// Content for the item
/// </summary>
[Parameter]
public RenderFragment ChildContent { get; set; }

Просмотреть файл

@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace AntDesign
{

Просмотреть файл

@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace AntDesign
{

Просмотреть файл

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.AspNetCore.Components;
using OneOf;
using Microsoft.AspNetCore.Components;
namespace AntDesign
{

Просмотреть файл

@ -1,38 +1,74 @@
using System;
using System.Collections.Generic;
using System.Text;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.AspNetCore.Components;
namespace AntDesign
{
/**
<summary>
<para>A divider line separates different content.</para>
<h2>When To Use</h2>
<list type="bullet">
<item>Divide sections of article.</item>
<item>Divide inline text and links such as the operation column of table.</item>
</list>
</summary>
*/
[Documentation(DocumentationCategory.Components, DocumentationType.Layout, "https://gw.alipayobjects.com/zos/alicdn/5swjECahe/Divider.svg")]
public partial class Divider : AntDomComponentBase
{
[Parameter] public RenderFragment ChildContent { get; set; }
[Parameter] public string Text { get; set; }
[Parameter] public bool Plain { get; set; } = false;
/// <summary>
/// Content to show inside the divider
/// </summary>
[Parameter]
public RenderFragment ChildContent { get; set; }
/// <summary>
/// 'horizontal' | 'vertical'
/// Text to show inside the divider
/// </summary>
[Parameter] public DirectionVHType Type { get; set; } = DirectionVHType.Horizontal;
[Parameter]
public string Text { get; set; }
/// <summary>
/// 'left' | 'right' | 'center'
/// When false, the text will not be a header style. When true it will be header style.
/// </summary>
[Parameter] public string Orientation { get; set; } = "center";
/// <default value="false" />
[Parameter]
public bool Plain { get; set; } = false;
[Parameter] public bool Dashed { get; set; } = false;
/// <summary>
/// Type of divider - 'horizontal' | 'vertical'
/// </summary>
/// <default value="DirectionVHType.Horizontal" />
[Parameter]
public DirectionVHType Type { get; set; } = DirectionVHType.Horizontal;
/// <summary>
/// Content/Text orientation - 'left' | 'right' | 'center'. Ignored when not using `Text` or `ChildContent`
/// </summary>
/// <default value="center" />
[Parameter]
public string Orientation { get; set; } = "center";
/// <summary>
/// Whether to style the line as dashed or not.
/// </summary>
/// <default value="false" />
[Parameter]
public bool Dashed { get; set; } = false;
private void SetClass()
{
ClassMapper.Clear()
.Add("ant-divider")
.If("ant-divider", () => RTL)
.Get(() => $"ant-divider-{this.Type.Name.ToLowerInvariant()}")
.Get(() => $"ant-divider-{Type.Name.ToLowerInvariant()}")
.If("ant-divider-with-text", () => Text != null || ChildContent != null)
.GetIf(() => $"ant-divider-with-text-{this.Orientation.ToLowerInvariant()}", () => Text != null || ChildContent != null)
.GetIf(() => $"ant-divider-with-text-{Orientation.ToLowerInvariant()}", () => Text != null || ChildContent != null)
.If($"ant-divider-plain", () => Plain && (Text != null || ChildContent != null))
.If("ant-divider-dashed", () => Dashed)
;
@ -41,6 +77,7 @@ namespace AntDesign
protected override void OnInitialized()
{
SetClass();
base.OnInitialized();
}
}

Просмотреть файл

@ -12,6 +12,27 @@ using OneOf;
namespace AntDesign
{
/**
<summary>
<para>A panel which slides in from the edge of the screen.</para>
<h2>When To Use</h2>
<para>
A Drawer is a panel that is typically overlaid on top of a page and slides in from the side.
It contains a set of information or actions.
Since the user can interact with the Drawer without leaving the current page, tasks can be achieved more efficiently within the same context.
</para>
<list type="bullet">
<item>Use a Form to create or edit a set of information.</item>
<item>Processing subtasks. When subtasks are too heavy for a Popover and we still want to keep the subtasks in the context of the main task, Drawer comes very handy.</item>
<item>When the same Form is needed in multiple places.</item>
</list>
</summary>
<seealso cref="DrawerService" />
<seealso cref="DrawerOptions" />
<seealso cref="DrawerRef" />
*/
[Documentation(DocumentationCategory.Components, DocumentationType.Feedback, "https://gw.alipayobjects.com/zos/alicdn/7z8NJQhFb/Drawer.svg")]
public partial class Drawer : AntDomComponentBase
{
#region Parameters
@ -31,57 +52,36 @@ namespace AntDesign
}
/// <summary>
/// <para>
/// 是否显示右上角的关闭按钮
/// </para>
/// <para>
/// Whether a close (x) button is visible on top right of the Drawer dialog or not.
/// </para>
/// </summary>
/// <default value="true" />
[Parameter]
public bool Closable { get; set; } = true;
/// <summary>
/// <para>
/// 点击蒙层是否允许关闭
/// </para>
/// <para>
/// Clicking on the mask (area outside the Drawer) to close the Drawer or not.
/// </para>
/// </summary>
/// <default value="true" />
[Parameter]
public bool MaskClosable { get; set; } = true;
/// <summary>
/// <para>
/// 是否显示蒙层
/// </para>
/// <para>
/// Whether to show mask or not.
/// </para>
/// </summary>
/// <default value="true" />
[Parameter]
public bool Mask { get; set; } = true;
/// <summary>
/// <para>
/// 蒙层样式
/// </para>
/// <para>
/// Style for Drawer's mask element.
/// </para>
/// </summary>
[Parameter]
public string MaskStyle { get; set; }
/// <summary>
/// <para>
/// 是否支持键盘 esc 关闭
/// </para>
/// <para>
/// Whether to support keyboard esc off
/// </para>
/// </summary>
/// <default value="true" />
[Parameter]
public bool Keyboard { get; set; } = true;
@ -92,12 +92,7 @@ namespace AntDesign
private OneOf<RenderFragment, string> _title;
/// <summary>
/// <para>
/// 标题
/// </para>
/// <para>
/// The title for Drawer.
/// </para>
/// </summary>
[Parameter]
public OneOf<RenderFragment, string> Title
@ -119,79 +114,48 @@ namespace AntDesign
}
/// <summary>
/// <para>
/// Drawer 的位置,字符串, "left" | "right" | "top" | "bottom"
/// </para>
/// <para>
/// The placement of the Drawer, option could be left, top, right, bottom
/// </para>
/// </summary>
/// <default value="right" />
[Parameter]
public string Placement { get; set; } = "right";
/// <summary>
/// <para>
/// Drawer body 样式
/// </para>
/// <para>
/// Body style for modal body element. Such as height, padding etc.
/// </para>
/// </summary>
[Parameter]
public string BodyStyle { get; set; }
/// <summary>
/// <para>
/// Drawer header 抽屉头
/// </para>
/// <para>
/// Header style for modal header element. Such as height, padding etc.
/// </para>
/// </summary>
[Parameter]
public string HeaderStyle { get; set; }
/// <summary>
/// <para>
/// Drawer对话框外层容器的类名
/// </para>
/// <para>
/// The class name of the container of the Drawer dialog.
/// </para>
/// The class name of the container of the Drawer dialog.
/// </summary>
[Parameter]
public string WrapClassName { get; set; }
/// <summary>
/// <para>
/// 宽度,仅当 <see cref="Placement"/> 为 "left" 或 "right" 时生效
/// </para>
/// <para>
/// Width of the Drawer dialog, only when placement is 'left' or 'right'.
/// </para>
/// </summary>
/// <default value="256" />
[Parameter]
public string Width { get; set; } = "256";
/// <summary>
/// <para>
/// 高度,仅当 <see cref="Placement"/> 为 "top" 或 "bottom" 时生效
/// </para>
/// <para>
/// Height of the Drawer dialog, only when placement is 'top' or 'bottom'.
/// </para>
/// </summary>
/// <default value="256" />
[Parameter]
public string Height { get; set; } = "256";
/// <summary>
/// <para>
/// 设置 Drawer 的 z-index
/// </para>
/// <para>
/// The z-index of the Drawer.
/// </para>
/// </summary>
/// <default value="1000" />
[Parameter]
public int ZIndex
{
@ -209,35 +173,23 @@ namespace AntDesign
private string InnerZIndexStyle => (_status.IsOpen() || _status == ComponentStatus.Closing) ? _zIndexStyle : "z-index:-9999;";
/// <summary>
/// <para>
/// X 轴方向的偏移量,只在方向为 'left'或'right' 时生效.
/// </para>
/// <para>
/// The the X coordinate offset(px), only when placement is 'left' or 'right'.
/// </para>
/// </summary>
/// <default value="0" />
[Parameter]
public int OffsetX { get; set; } = 0;
/// <summary>
/// <para>
/// Y 轴方向的偏移量,只在方向为 'top'或'bottom' 时生效
/// </para>
/// <para>
/// The the Y coordinate offset(px), only when placement is 'top' or 'bottom'.
/// </para>
/// </summary>
/// <default value="0" />
[Parameter]
public int OffsetY { get; set; } = 0;
/// <summary>
/// <para>
/// Drawer 是否可见
/// </para>
/// <para>
/// Whether the Drawer dialog is visible or not.
/// </para>
/// </summary>
/// <default value="false" />
[Parameter]
public bool Visible
{
@ -263,23 +215,13 @@ namespace AntDesign
public EventCallback<bool> VisibleChanged { get; set; }
/// <summary>
/// <para>
/// 在 Drawer 打开前的回调事件
/// </para>
/// <para>
/// Specify a callback that will be called before drawer displayed
/// </para>
/// </summary>
[Parameter]
public Func<Task> OnOpen { get; set; }
/// <summary>
/// <para>
/// 在 关闭 前的回调事件,应当在 OnClose 将 <see cref="Visible"/> 设置为false
/// </para>
/// <para>
/// Specify a callback that will be called when a user clicks mask, close button or Cancel button.
/// </para>
/// </summary>
[Parameter]
public EventCallback OnClose { get; set; }

Просмотреть файл

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;

Просмотреть файл

@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Threading.Tasks;
namespace AntDesign
@ -27,7 +25,7 @@ namespace AntDesign
}
/// <summary>
/// close Confirm dialog
/// close drawer
/// </summary>
/// <returns></returns>
public override async Task CloseAsync()
@ -44,7 +42,7 @@ namespace AntDesign
/// <summary>
/// Open Confirm dialog
/// Open drawer
/// </summary>
/// <returns></returns>
public override async Task OpenAsync()
@ -53,7 +51,7 @@ namespace AntDesign
}
/// <summary>
/// update Confirm dialog config which Visible=true
/// update drawer config which Visible=true
/// </summary>
/// <returns></returns>
public override async Task UpdateConfigAsync()
@ -62,7 +60,7 @@ namespace AntDesign
}
/// <summary>
/// update Confirm dialog config with a new ConfirmOptions
/// update drawer config with a new options
/// </summary>
/// <param name="config"></param>
/// <returns></returns>

Просмотреть файл

@ -1,8 +1,10 @@
using System;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Routing;
using Microsoft.JSInterop;
namespace AntDesign
{

Просмотреть файл

@ -1,52 +1,106 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components;
using OneOf;
namespace AntDesign
{
public class DrawerOptions
{
/// <summary>
/// The drawer body content.
/// </summary>
public OneOf<RenderFragment, string> Content { get; set; }
public RenderFragment ChildContent { get; set; }
/// <summary>
/// Whether a close (x) button is visible on top right of the Drawer dialog or not.
/// </summary>
/// <default value="true" />
public bool Closable { get; set; } = true;
/// <summary>
/// Clicking on the mask (area outside the Drawer) to close the Drawer or not.
/// </summary>
/// <default value="true" />
public bool MaskClosable { get; set; } = true;
/// <summary>
/// Whether to show mask or not.
/// </summary>
/// <default value="true" />
public bool Mask { get; set; } = true;
/// <summary>
/// Whether to support keyboard esc off
/// </summary>
/// <default value="true" />
public bool Keyboard { get; set; } = true;
/// <summary>
/// The title for Drawer.
/// </summary>
public OneOf<RenderFragment, string> Title { get; set; }
/// <summary>
/// "left" | "right" | "top" | "bottom"
/// The placement of the Drawer - Possible values: "left", "right", "top", "bottom"
/// </summary>
/// <default value="right" />
public string Placement { get; set; } = "right";
/// <summary>
/// Style for Drawer's mask element.
/// </summary>
public string MaskStyle { get; set; }
/// <summary>
/// Body style for Drawer body element. Such as height, padding etc.
/// </summary>
public string BodyStyle { get; set; }
/// <summary>
/// Header style for Drawer header element. Such as height, padding etc.
/// </summary>
public string HeaderStyle { get; set; }
/// <summary>
/// The class name of the container of the Drawer dialog.
/// </summary>
public string WrapClassName { get; set; }
/// <summary>
/// Width of the Drawer dialog.
/// </summary>
/// <default value="256" />
public string Width { get; set; } = "256";
/// <summary>
/// Height of the Drawer dialog, only when placement is 'top' or 'bottom'.
/// </summary>
/// <default value="256" />
public string Height { get; set; } = "256";
/// <summary>
/// The z-index of the Drawer.
/// </summary>
/// <default value="1000" />
public int ZIndex { get; set; } = 1000;
/// <summary>
/// The the X coordinate offset(px), only when placement is 'left' or 'right'.
/// </summary>
/// <default value="0" />
public int OffsetX { get; set; } = 0;
/// <summary>
/// The the Y coordinate offset(px), only when placement is 'top' or 'bottom'.
/// </summary>
/// <default value="0" />
public int OffsetY { get; set; } = 0;
/// <summary>
/// If the drawer is visible or not
/// </summary>
/// <default value="false" />
public bool Visible { get; set; }
}
}

Просмотреть файл

@ -1,4 +1,8 @@
using System;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Threading.Tasks;
using AntDesign.Internal;
using Microsoft.AspNetCore.Components;
@ -6,11 +10,47 @@ using Microsoft.AspNetCore.Components.Web;
namespace AntDesign
{
/**
<summary>
<para>A dropdown list.</para>
<h2>When To Use</h2>
<para>
When there are more than a few options to choose from, you can wrap them in a <c>Dropdown</c>.
By hovering or clicking on the trigger, a dropdown menu will appear, which allows you to choose an option and execute the relevant action.
</para>
<h2>Two types</h2>
<para>There are 2 rendering approaches for <c>Dropdown</c>:</para>
<list type="number">
<item>Wraps child element (content of the <c>Dropdown</c>) with a <c>div</c> (default approach).</item>
<item>
Child element is not wrapped with anything. This approach requires usage of <c>Unbound</c> tag inside <c>Dropdown</c> and depending on the child element type (please refer to the first example):
<list type="bullet">
<item>html tag: has to have its <c>@ref</c> set to <c>@context.Current</c> </item>
<item><c>Ant Design Blazor</c> component: has to have its <c>RefBack</c> attribute set to <c>@context</c>.</item>
</list>
</item>
</list>
</summary>
<seealso cref="DropdownButton"/>
*/
[Documentation(DocumentationCategory.Components, DocumentationType.Navigation, "https://gw.alipayobjects.com/zos/alicdn/eedWN59yJ/Dropdown.svg")]
public partial class Dropdown : OverlayTrigger
{
/// <summary>
/// Whether the dropdown arrow should be visible.
/// </summary>
/// <default value="false" />
[Parameter]
public bool Arrow { get; set; }
/// <summary>
/// Whether the dropdown arrow should point at center
/// </summary>
/// <default value="false" />
[Parameter]
public bool ArrowPointAtCenter { get; set; }

Просмотреть файл

@ -1,7 +1,10 @@
using System;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Text.Json;
using System.Threading.Tasks;
using AntDesign.JsInterop;
using Microsoft.AspNetCore.Components;
using OneOf;
@ -78,6 +81,7 @@ namespace AntDesign
/// <summary>
/// Set the danger status of button
/// </summary>
/// <default value="false" />
[Parameter]
public bool Danger
{
@ -92,6 +96,7 @@ namespace AntDesign
/// <summary>
/// Used in situations with complex background, home pages usually.
/// </summary>
/// <default value="false" />
[Parameter]
public bool Ghost
{
@ -109,6 +114,7 @@ namespace AntDesign
/// Icon that will be rendered in the right
/// button.
/// </summary>
/// <default value="ellipsis" />
[Parameter]
public string Icon
{
@ -124,6 +130,7 @@ namespace AntDesign
/// Indicates if loading icon is going to be included.
/// If set to true, then dropdown will not be active.
/// </summary>
/// <default value="false" />
[Parameter]
public bool Loading
{
@ -140,6 +147,7 @@ namespace AntDesign
/// <summary>
/// Button size.
/// </summary>
/// <default value="AntSizeLDSType.Default" />
[Parameter]
public string Size
{
@ -155,6 +163,7 @@ namespace AntDesign
/// Allows to set each button's type either to the same string
/// or separately. Use AntDesign.ButtonType helper class.
/// </summary>
/// <default value="ButtonType.Default" />
[Parameter]
public OneOf<string, (string LeftButton, string RightButton)> Type

Просмотреть файл

@ -1,34 +1,76 @@
using Microsoft.AspNetCore.Components;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.AspNetCore.Components;
using OneOf;
namespace AntDesign
{
/**
<summary>
<para>Empty state placeholder.</para>
<h2>When To Use</h2>
<list type="bullet">
<item>When there is no data provided, display for friendly tips.</item>
<item>User tutorial to create something in fresh new situation.</item>
</list>
</summary>
*/
[Documentation(DocumentationCategory.Components, DocumentationType.DataDisplay, "https://gw.alipayobjects.com/zos/alicdn/MNbKfLBVb/Empty.svg", Columns = 1)]
public partial class Empty : AntDomComponentBase
{
[Parameter]
public string PrefixCls { get; set; } = "ant-empty";
/// <summary>
/// Style for the wrapper of the image. Always used regardless of image type.
/// </summary>
[Parameter]
public string ImageStyle { get; set; }
/// <summary>
/// Use small variant of Empty
/// </summary>
[Parameter]
public bool Small { get; set; }
/// <summary>
/// Use simple variant of Empty. Changes image as well.
/// </summary>
[Parameter]
public bool Simple { get; set; }
/// <summary>
/// Content displayed after the empty view
/// </summary>
[Parameter]
public RenderFragment ChildContent { get; set; }
/// <summary>
/// Description for the view
/// </summary>
/// <default value="No Data (in current locale)" />
[Parameter]
public OneOf<string, bool?> Description { get; set; } = LocaleProvider.CurrentLocale.Empty.Description;
/// <summary>
/// Description content for the view. Takes priority over <see cref="Description"/>
/// </summary>
[Parameter]
public RenderFragment DescriptionTemplate { get; set; }
/// <summary>
/// Image URL for view. Takes priority over <see cref="Simple"/>
/// </summary>
[Parameter]
public string Image { get; set; }
/// <summary>
/// Image content for empty view. Takes priority over <see cref="Image"/> and <see cref="Simple"/>
/// </summary>
[Parameter]
public RenderFragment ImageTemplate { get; set; }

Просмотреть файл

@ -34,7 +34,8 @@
</svg>
@code {
[Parameter] public string PrefixCls { get; set; } = "ant-empty-img-default";
[Parameter]
public string PrefixCls { get; set; } = "ant-empty-img-default";
protected void SetClass()
{

Просмотреть файл

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace AntDesign
namespace AntDesign
{
public class EmptyLocale
{

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше