namespace Connected.Annotations; /// /// Specifies the name of the category in which to group the property of a MudBlazor component when displayed in the API documentation. /// /// /// Use this attribute together with the .
/// This attribute is similar to .
/// The name of the category can be specified by using a constant defined in the class. ///
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] public class CategoryAttribute : Attribute { public CategoryAttribute(string name) { if (string.IsNullOrEmpty(name)) throw new ArgumentException("The category name cannot be null nor empty."); if (!categoryOrder.ContainsKey(name)) throw new ArgumentException($"The given category name '{name}' isn't in the categoryOrder field."); Name = name; } /// The name of the category. public string Name { get; } /// The order of the category - the greater the number the lower the category will be displayed in the API documentation. public int Order => categoryOrder[Name]; // Possible categories of component properties and the order in which they are displayed in the API documentation. private static readonly Dictionary categoryOrder = new() { ["Data"] = 0, // general category ["Validation"] = 1, // general category // specific categories associated with data ["Validated data"] = 2, ["Validation result"] = 3, ["Behavior"] = 100, // general category ["Header"] = 101, ["Rows"] = 102, ["Footer"] = 103, // specific behaviors of a component ["Filtering"] = 200, ["Grouping"] = 201, ["Expanding"] = 202, ["Sorting"] = 203, ["Pagination"] = 204, ["Selecting"] = 205, ["Editing"] = 206, ["Click action"] = 207, ["Items"] = 208, ["Disable"] = 209, ["DraggingClass"] = 210, ["DropRules"] = 211, ["Appearance"] = 300, // general category // specific parts of a component together with their behavior and appearance ["Popup behavior"] = 400, ["Popup appearance"] = 401, ["List behavior"] = 402, ["List appearance"] = 403, ["Picker behavior"] = 404, ["Picker appearance"] = 405, ["Dot"] = 406, // "Miscellaneous" category. In classes inheriting from MudComponentBase it can be used only exceptionally - // - only when the property can define behavior or appearance depending on value of the property. ["Misc"] = int.MaxValue - 1, ["Common"] = int.MaxValue // general category }; } /// /// Possible categories of MudBlazor components properties. /// /// /// General categories /// /// - Data - Used e.g. in form fields, pickers, , , , /// , and . Containers have this group when their items can be defined /// not only in markup language, but also programmatically in the Items property and by specifying ItemTemplate.
/// - Validation - Used in form fields and pickers.
/// - Behavior - Changing these properties changes behavior of the component and behavior of the application. So in some way they are or may be more /// important than the "Appearance" category. Example properties are: a) the Disabled property, b) icons (or avatars) without default value /// (because setting their value can pass additional information).
/// - Appearance - Changing these properties doesn't change behavior of the component and behavior of the application, but only changes the appearance /// of the component irrelevant to the understanding of the application by a user. So in some way they are less important than the "Behavior" /// category, because they are only used to adjust the look of the application. Example properties are: a) Elevation, Outlined, /// Square, Rounded, DisableGutters, Dense, DisableRipple; b) size, color, and typography of the item /// and its subelements; c) CSS classes and styles of subelements; d) icons with the default value already set (because most often changing its value /// doesn't change passed information).
/// - Common - Properties defined in . ///
/// /// Note: The following properties belong to the "Behavior" group, not to the "Appearance" group:
/// - - because it describes meaning of the button, since MudIconButton doesn't have text,
/// - - because it describes meaning of the field,
/// - - because it can describe information important to a user, e.g. a numeric field unit such as kilograms.
/// Sometimes choosing a category can be difficult - in such case choose a category that makes the most sense. ///
/// /// Categories for specific behaviors or specific parts of components /// If some elements or behaviors can be distinguished in a component, then their properties are included in separate groups. /// /// Note: If a property qualifies for both the "Appearance" or "Behavior" group, and for some special group, then this special group takes precedence. /// For example, could belong to the "Appearance" group, but belongs to the "Editing" group. /// /// Additional information /// The list of categories is inspired by the categories displayed for Windows Forms and Web Forms components in the Visual Studio "Properties" window. ///
public static class CategoryTypes { /* Implementation note: * Almost all components use the "Behavior" and "Appearance" categories. We could simplify the code * by inheriting these constants, but C# doesn't allow to inherit static members of a class. */ /// Used in . public static class ComponentBase { public const string Common = "Common"; } /// Used in: , all components inheriting from it, and . public static class Button { public const string Behavior = "Behavior"; public const string ClickAction = "Click action"; public const string Appearance = "Appearance"; } /// Used in and all components inheriting from it. public static class FormComponent { public const string Data = "Data"; public const string Validation = "Validation"; public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; public const string ListBehavior = "List behavior"; public const string ListAppearance = "List appearance"; public const string PickerBehavior = "Picker behavior"; public const string PickerAppearance = "Picker appearance"; } /// Used in all charts, that is in and all components inheriting from it. public static class Chart { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } /// Used in other base classes. public static class General { public const string Data = "Data"; public const string Behavior = "Behavior"; public const string ClickAction = "Click action"; public const string Appearance = "Appearance"; } public static class Alert { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class AppBar { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class Avatar { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class AvatarGroup { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class Badge { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class Breadcrumbs { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class BreakpointProvider { public const string Behavior = "Behavior"; } public static class ButtonGroup { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class Card { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class Carousel { public const string Data = "Data"; public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class Chip { public const string Behavior = "Behavior"; public const string ClickAction = "Click action"; public const string Appearance = "Appearance"; } public static class ChipSet { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class Container { public const string Behavior = "Behavior"; } public static class Dialog { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; public const string Misc = "Misc"; } public static class Divider { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class Drawer { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class DropZone { public const string Appearance = "Appearance"; public const string Behavior = "Behavior"; public const string Disabled = "Disable"; public const string Sorting = "Sorting"; public const string DraggingClass = "DraggingClass"; public const string DropRules = "DropRules"; public const string Items = "Items"; } public static class Element { public const string Misc = "Misc"; } public static class ExpansionPanel { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class Field { public const string Data = "Data"; public const string Validation = "Validation"; public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class FileUpload { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class FocusTrap { public const string Behavior = "Behavior"; } public static class Form { public const string ValidatedData = "Validated data"; public const string ValidationResult = "Validation result"; public const string Behavior = "Behavior"; } public static class Grid { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class Highlighter { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class Image { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class Item { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class Hidden { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class Icon { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class Link { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class List { public const string Behavior = "Behavior"; public const string Expanding = "Expanding"; public const string Selecting = "Selecting"; public const string ClickAction = "Click action"; public const string Appearance = "Appearance"; } public static class MainContent { public const string Behavior = "Behavior"; } public static class Menu { public const string Behavior = "Behavior"; public const string ClickAction = "Click action"; public const string Appearance = "Appearance"; public const string PopupBehavior = "Popup behavior"; public const string PopupAppearance = "Popup appearance"; } public static class MessageBox { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class NavMenu { public const string Behavior = "Behavior"; public const string ClickAction = "Click action"; public const string Appearance = "Appearance"; } public static class Overlay { public const string Behavior = "Behavior"; public const string ClickAction = "Click action"; } public static class Pagination { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class Paper { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class Popover { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class ProgressLinear { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class ProgressCircular { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class Radio { public const string Data = "Data"; public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class Rating { public const string Data = "Data"; public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class RTLProvider { public const string Behavior = "Behavior"; } public static class ScrollToTop { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class Skeleton { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class Stack { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class Slider { public const string Data = "Data"; public const string Validation = "Validation"; public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class SwipeArea { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class Table { public const string Data = "Data"; public const string Behavior = "Behavior"; public const string Header = "Header"; public const string Rows = "Rows"; public const string Footer = "Footer"; public const string Filtering = "Filtering"; public const string Grouping = "Grouping"; public const string Sorting = "Sorting"; public const string Pagination = "Pagination"; public const string Selecting = "Selecting"; public const string Editing = "Editing"; public const string Appearance = "Appearance"; } public static class SimpleTable { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class Tabs { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class Timeline { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; public const string Dot = "Dot"; } public static class ToolBar { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class Tooltip { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } public static class TreeView { public const string Data = "Data"; public const string Behavior = "Behavior"; public const string Expanding = "Expanding"; public const string Selecting = "Selecting"; public const string ClickAction = "Click action"; public const string Appearance = "Appearance"; } public static class Text { public const string Behavior = "Behavior"; public const string Appearance = "Appearance"; } }