using System; using System.Linq; using System.Linq.Expressions; using System.Collections.Generic; namespace BlazorApp { public class ExampleService { Example[] allExamples = new[] { new Example() { Name = "First Look", Path = "/", Icon = "" }, new Example() { Name = "Dashboard", Path = "/dashboard", Icon = "" }, new Example { Name = "Get Started", Title = "How to get started with the Radzen Blazor components", Path = "/get-started", Icon = "" }, new Example { Name = "Support", Title = "How to get support for the Radzen Blazor components", Path = "/support", Icon = "" }, new Example() { Name="DataGrid", Children = new [] { new Example { Name = "Data-binding", Icon = "", Children = new [] { new Example { Name = "IQueryable", Path = "datagrid", Tags = new [] { "datatable", "datagridview", "dataview", "grid", "table" } }, new Example { Name = "LoadData event", Path = "datagrid-loaddata", Title = "Blazor DataGrid custom data-binding", Tags = new [] { "datagrid", "bind", "load", "data", "loaddata", "custom" } }, new Example { Name = "OData service", Path = "datagrid-odata", Title = "Blazor DataGrid OData data-binding", Icon = "", Tags = new [] { "datagrid", "bind", "load", "data", "loaddata", "odata", "service", "rest" } }, new Example { Name = "Dynamic data", Path = "datagrid-dynamic", Title = "Blazor DataGrid binding dynamic data", Icon = "", Tags = new [] { "datagrid", "bind", "load", "data", "loaddata", "dynamic" } }, } }, new Example { Name = "Virtualization", Icon = "", Children = new [] { new Example { Name = "IQueryable support", Path = "datagrid-virtualization", Title = "Blazor DataGrid IQueryable virtualization", Tags = new [] { "datagrid", "bind", "load", "data", "virtualization", "ondemand" } }, new Example { Name = "LoadData support", Path = "datagrid-virtualization-loaddata", Title = "Blazor DataGrid custom virtualization", Tags = new [] { "datagrid", "bind", "load", "data", "loaddata", "virtualization", "ondemand" } }, } }, new Example { Name = "Columns", Icon = "", Children = new [] { new Example { Name = "Template", Path = "datagrid-column-template", Title = "Blazor DataGrid column template", Tags = new [] { "column", "template", "grid", "datagrid", "table"} }, new Example { Name = "Resizing", Path = "datagrid-column-resizing", Title = "Blazor DataGrid column resizing", Tags = new [] { "column", "resizing", "grid", "datagrid", "table"} }, new Example { Name = "Footer Totals", Path = "datagrid-footer-totals", Title = "Blazor DataGrid footer totals", Tags = new [] { "summary", "total", "aggregate", "datagrid", "table", "dataview" } }, new Example { Name = "Filter Template", Path = "datagrid-filter-template", Title = "Blazor DataGrid custom filtering", Tags = new [] { "datagrid", "column", "filter", "template" } }, new Example { Name = "Frozen Columns", Path = "datagrid-frozen-columns", Title = "Blazor DataGrid frozen columns", Tags = new [] { "datagrid", "column", "frozen", "locked" } } } }, new Example { Name = "Filtering", Icon = "", Children = new [] { new Example { Name = "Simple Mode", Path = "datagrid-simple-filter", Title = "Blazor DataGrid Simple filter mode", Tags = new [] { "filter", "simple", "grid", "datagrid", "table"} }, new Example { Name = "Advanced Mode", Path = "datagrid-advanced-filter", Title = "Blazor DataGrid Simple filter mode", Tags = new [] { "filter", "advanced", "grid", "datagrid", "table"} }, new Example { Name = "Filter API", Path = "datagrid-filter-api", Title = "Blazor DataGrid Filter API", Tags = new [] { "filter", "api", "grid", "datagrid", "table"} }, } }, new Example { Name = "Hierarchy", Icon = "", Children = new [] { new Example { Name = "Hierarchy", Path = "master-detail-hierarchy", Title = "Blazor DataGrid Hierarchy", Tags = new [] { "master", "detail", "datagrid", "table", "dataview" } }, new Example { Name = "Hierarchy on demand", Path = "master-detail-hierarchy-demand", Title = "Blazor DataGrid Hierarchy on demand", Tags = new [] { "master", "detail", "datagrid", "table", "dataview", "on-demand" } }, new Example { Name = "Master/Detail", Path = "master-detail", Title = "Master and detail Blazor DataGrid", Tags = new [] { "master", "detail", "datagrid", "table", "dataview" } }, } }, new Example { Name = "Selection", Icon = "", Children = new [] { new Example { Name = "Single selection", Path = "datagrid-single-selection", Title = "Blazor DataGrid single selection", Tags = new [] { "single", "selection", "datagrid", "table", "dataview" } }, new Example { Name = "Multiple selection", Path = "datagrid-multiple-selection", Title = "Blazor DataGrid Multiple selection", Tags = new [] { "multiple", "selection", "datagrid", "table", "dataview" } }, } }, new Example { Name = "Sorting", Icon = "", Children = new [] { new Example { Name = "Single Column Sorting", Path = "datagrid-sort", Title = "Blazor DataGrid sorting", Tags = new [] { "single", "sort", "datagrid", "table", "dataview" } }, new Example { Name = "Multiple Column Sorting", Path = "datagrid-multi-sort", Title = "Blazor DataGrid multiple column sorting", Tags = new [] { "multi", "sort", "datagrid", "table", "dataview" } }, new Example { Name = "Sort API", Path = "datagrid-sort-api", Title = "Blazor DataGrid Sort API", Tags = new [] { "api", "sort", "datagrid", "table", "dataview" } } } }, new Example { Name = "Paging", Icon = "", Children = new [] { new Example { Name = "Pager Position", Path = "datagrid-pager-position", Title = "Blazor DataGrid pager position", Tags = new [] { "pager", "paging", "datagrid", "table", "dataview" } }, new Example { Name = "Pager API", Path = "datagrid-pager-api", Title = "Blazor DataGrid pager API", Tags = new [] { "pager", "paging", "api", "datagrid", "table", "dataview" } } } }, new Example() { Name = "InLine Editing", Path = "datagrid-inline-edit", Title = "Blazor DataGrid InLine Editing", Icon = "", Tags = new [] { "inline", "editor", "datagrid", "table", "dataview" } }, new Example() { Name = "Conditional formatting", Path = "datagrid-conditional-template", Title = "DataGrid conditional template", Icon = "", Tags = new [] { "conditional", "template", "style", "datagrid", "table", "dataview" } }, new Example() { Name = "Export to Excel and CSV", Path = "export-excel-csv", Title = "Blazor DataGrid export to Excel and CSV", Icon = "", Tags = new [] { "export", "excel", "csv" } }, new Example() { Name = "Cascading DropDowns", Path = "cascading-dropdowns", Title = "Blazor Cascading DropDowns", Icon = "", Tags = new [] { "related", "parent", "child" } }, } }, new Example { Name="Data", Children = new [] { new Example() { Name = "DataList", Path = "datalist", Icon = "", Tags = new [] { "dataview", "grid", "table" } }, new Example() { Name = "Pager", Path = "pager", Icon = "", Tags = new [] { "pager", "paging" } }, new Example() { Name = "Tree", Path = "tree", Icon = "", Tags = new [] { "tree", "treeview", "nodes", "hierarchy" } }, new Example() { Name = "Scheduler", Path = "scheduler", Icon = "", Tags = new [] { "scheduler", "calendar", "event", "appointment"} }, } }, new Example() { Name="HtmlEditor", Children = new [] { new Example() { Name = "Default Tools", Path = "html-editor", Icon = "", Tags = new [] { "html", "editor", "rich", "text" } }, new Example() { Name = "Custom Tools", Path = "html-editor-custom-tools", Icon = "", Tags = new [] { "html", "editor", "rich", "text", "tool", "custom" } }, } }, new Example { Name="Charts", Children= new [] { new Example { Name = "Line Chart", Path = "line-chart", Icon = "", Tags = new [] { "chart", "graph", "line" } }, new Example { Name = "Area Chart", Path = "area-chart", Icon = "", Tags = new [] { "chart", "graph", "area" } }, new Example { Name = "Column Chart", Path = "column-chart", Icon = "", Tags = new [] { "chart", "graph", "column", "bar" } }, new Example { Name = "Bar Chart", Path = "bar-chart", Icon = "", Tags = new [] { "chart", "graph", "column", "bar" } }, new Example { Name = "Pie Chart", Path = "pie-chart", Icon = "", Tags = new [] { "chart", "graph", "pie" } }, new Example { Name = "Donut Chart", Path = "donut-chart", Icon = "", Tags = new [] { "chart", "graph", "donut" } }, new Example { Name = "Styling", Path = "styling-chart", Icon = "", Tags = new [] { "chart", "graph", "styling" } }, } }, new Example() { Name="Forms", Children = new [] { new Example() { Name = "AutoComplete", Path = "autocomplete", Icon = "", Tags = new [] { "form", "complete", "suggest", "edit" } }, new Example() { Name = "Switch", Path = "switch", Icon = "", Tags = new [] { "form", "edit", "switch" } }, new Example() { Name = "CheckBox", Path = "checkbox", Icon = "", Tags = new [] { "form", "edit" } }, new Example() { Name = "CheckBoxList", Path = "checkboxlist", Icon = "", Tags = new [] { "form", "edit" } }, new Example() { Name = "ColorPicker", Path = "colorpicker", Icon = "", Tags = new [] { "form", "edit" } }, new Example() { Name = "DatePicker", Path = "datepicker", Icon = "", Tags = new [] { "calendar", "form", "edit" } }, new Example() { Name = "DropDown", Path = "dropdown", Icon = "", Tags = new [] { "select", "picker", "form" , "edit" } }, new Example() { Name = "DropDownDataGrid", Path = "dropdown-datagrid", Icon = "", Tags = new [] { "select", "picker", "form", "edit" } }, new Example() { Name = "FileInput", Path = "fileinput", Icon = "", Tags = new [] { "upload", "form", "edit" } }, new Example() { Name = "ListBox", Path = "listbox", Icon = "", Tags = new [] { "select", "picker", "form", "edit" } }, new Example() { Name = "Numeric", Path = "numeric", Icon = "", Tags = new [] { "input", "number", "form", "edit" } }, new Example() { Name = "Password", Path = "password", Icon = "", Tags = new [] { "input", "form", "edit" } }, new Example() { Name = "RadioButtonList", Path = "radiobuttonlist", Icon = "", Tags = new [] { "toggle", "form", "edit" } }, new Example() { Name = "Rating", Path = "rating", Icon = "", Tags = new [] { "star", "form", "edit" } }, new Example() { Name = "SelectBar", Path = "selectbar", Icon = "", Tags = new [] { "form", "edit" } }, new Example() { Name = "Slider", Path = "slider", Icon = "", Tags = new [] { "form", "slider" } }, new Example() { Name = "TemplateForm", Path = "templateform", Icon = "", Tags = new [] { "form", "edit" } }, new Example() { Name = "TextBox", Path = "textbox", Icon = "", Tags = new [] { "input", "form", "edit" } }, new Example() { Name = "Mask", Path = "mask", Icon = "", Tags = new [] { "input", "form", "edit", "mask" } }, new Example() { Name = "TextArea", Path = "textarea", Icon = "", Tags = new [] { "input", "form", "edit" } }, }, }, new Example() { Name = "Validators", Children = new [] { new Example() { Name = "RequiredValidator", Path = "requiredvalidator", Icon = "", Tags = new [] { "validator", "validation", "required"} }, new Example() { Name = "LengthValidator", Path = "lengthvalidator", Icon = "", Tags = new [] { "validator", "validation", "required", "length"} } , new Example() { Name = "NumericRangeValidator", Path = "numericrangevalidator", Icon = "", Tags = new [] { "validator", "validation", "required", "range"} }, new Example() { Name = "CompareValidator", Path = "comparevalidator", Icon = "", Tags = new [] { "validator", "validation", "required", "compare"} }, new Example() { Name = "EmailValidator", Path = "emailvalidator", Icon = "", Tags = new [] { "validator", "validation", "required", "email"} }, new Example() { Name = "RegexValidator", Path = "regexvalidator", Icon = "", Tags = new [] { "validator", "validation", "pattern", "regex", "regular", "expression"} } } }, new Example() { Name="Containers", Children = new [] { new Example() { Name = "Accordion", Path = "accordion", Icon = "", Tags = new [] { "panel", "container" } }, new Example() { Name = "Card", Path = "card", Icon = "", Tags = new [] { "container" } }, new Example() { Name = "Fieldset", Path = "fieldset", Icon = "", Tags = new [] { "form", "container" } }, new Example() { Name = "Panel", Path = "panel", Icon = "", Tags = new [] { "container" } }, new Example() { Name = "Tabs", Path = "tabs", Icon = "", Tags = new [] { "tabstrip", "tabview", "container" } }, new Example() { Name = "Steps", Path = "steps", Icon = "", Tags = new [] { "step", "steps", "wizard" } }, } }, new Example { Name="Gauges", Children= new [] { new Example { Name = "Radial Gauge", Path = "radial-gauge", Icon = "", Tags = new [] { "gauge", "graph", "radial", "circle" } }, new Example { Name = "Arc Gauge", Path = "arc-gauge", Icon = "", Tags = new [] { "gauge", "graph", "arc", "progress" } }, new Example { Name = "Styling Gauge", Path = "styling-gauge", Icon = "", Tags = new [] { "gauge", "graph", "styling" } }, } }, new Example() { Name = "Misc", Children = new [] { new Example() { Name = "Button", Path = "button", Icon = "" }, new Example() { Name = "GoogleMap", Path = "googlemap", Icon = "" }, new Example() { Name = "Gravatar", Path = "gravatar", Icon = "" }, new Example() { Name = "SplitButton", Path = "splitbutton", Icon = "" }, new Example() { Name = "Icon", Path = "icon", Icon = "" }, new Example() { Name = "Image", Path = "image", Icon = "" }, new Example() { Name = "Link", Path = "link", Icon = "" }, new Example() { Name = "Login", Path = "login", Icon = "" }, new Example() { Name = "ProgressBar", Path = "progressbar", Icon = "", Tags = new [] { "progress", "spinner" } }, new Example() { Name = "Dialog", Path = "dialog", Icon = "", Tags = new [] { "popup", "window" } }, new Example() { Name = "Notification", Path = "notification", Icon = "", Tags = new [] { "message", "alert" } }, new Example() { Name = "Tooltip", Path = "tooltip", Icon = "", Tags = new [] { "popup", "tooltip" } }, new Example() { Name = "Menu", Path = "menu", Icon = "", Tags = new [] { "navigation", "dropdown" } }, new Example() { Name = "PanelMenu", Path = "panelmenu", Icon = "", Tags = new [] { "navigation", "menu" } }, new Example() { Name = "ContextMenu", Path = "contextmenu", Icon = "", Tags = new [] { "popup", "dropdown", "menu" } }, new Example() { Name = "ProfileMenu", Path = "profile-menu", Icon = "", Tags = new [] { "navigation", "dropdown", "menu" } }, new Example() { Name = "Upload", Path = "example-upload", Icon = "", Tags = new [] { "upload", "file"} } } }, }; public IEnumerable Examples { get { return allExamples; } } public IEnumerable Filter(string term) { bool contains(string value) => value.Contains(term, StringComparison.OrdinalIgnoreCase); bool filter(Example example) => contains(example.Name) || (example.Tags != null && example.Tags.Any(contains)); bool deepFilter(Example example) => filter(example) || example.Children?.Any(filter) == true; return Examples.Where(category => category.Children?.Any(deepFilter) == true) .Select(category => new Example { Name = category.Name, Expanded = true, Children = category.Children.Where(deepFilter).Select(example => new Example { Name = example.Name, Path = example.Path, Icon = example.Icon, Expanded = true, Children = example.Children } ).ToArray() }).ToList(); } public Example FindCurrent(Uri uri) { return Examples.SelectMany(example => example.Children ?? new[] { example }) .FirstOrDefault(example => example.Path == uri.AbsolutePath || $"/{example.Path}" == uri.AbsolutePath); } public string TitleFor(Example example) { if (example != null && example.Name != "First Look") { return example.Title ?? $"Blazor {example.Name} | a free UI component by Radzen"; } return "Free Blazor Components | 60+ controls by Radzen"; } public string DescriptionFor(Example example) { return example?.Description ?? "The Radzen Blazor component library provides more than 50 UI controls for building rich ASP.NET Core web applications."; } } }