Bundle: redb / redb.PropsEditor (redb.PropsEditor.txt), 16 files Snapshot: development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb Index: https://redbase.app/src/dev-2026-12-06/redb/_index.txt ==== Path: redb/redb.PropsEditor/Attributes/PropsDisplayAttribute.cs Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb Page: https://redbase.app/src/dev-2026-12-06/redb/redb.PropsEditor/Attributes/PropsDisplayAttribute.cs ---- namespace redb.PropsEditor.Attributes; /// /// Specifies display settings for a property in PropsEditor. /// [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)] public class PropsDisplayAttribute : Attribute { /// /// Display label for the property. /// public string? Label { get; set; } /// /// Placeholder text for input fields. /// public string? Placeholder { get; set; } /// /// Description/help text shown below the field. /// public string? Description { get; set; } /// /// Display order within the group. /// public int Order { get; set; } public PropsDisplayAttribute() { } public PropsDisplayAttribute(string label) { Label = label; } } /// /// Renders the property as a multiline text area. /// [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)] public class PropsTextAreaAttribute : Attribute { /// /// Number of rows for the text area. /// public int Rows { get; set; } = 4; public PropsTextAreaAttribute() { } public PropsTextAreaAttribute(int rows) { Rows = rows; } } /// /// Hides the property from the editor. /// [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)] public class PropsHiddenAttribute : Attribute { } /// /// Groups properties together in a collapsible section. /// [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)] public class PropsGroupAttribute : Attribute { /// /// Name of the group. /// public string GroupName { get; set; } /// /// Whether the group is collapsed by default. /// public bool Collapsed { get; set; } public PropsGroupAttribute(string groupName) { GroupName = groupName; } } /// /// Marks the property as read-only in the editor. /// [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)] public class PropsReadOnlyAttribute : Attribute { } Path: redb/redb.PropsEditor/Components/ArrayEditor.razor Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb Page: https://redbase.app/src/dev-2026-12-06/redb/redb.PropsEditor/Components/ArrayEditor.razor ---- @using Microsoft.FluentUI.AspNetCore.Components @* Editor for string arrays with add/remove functionality *@
@Items.Length items @if (!IsReadOnly) { + Add }
@for (int i = 0; i < Items.Length; i++) { var index = i;
[@index]
@if (!IsReadOnly) { X }
} @if (Items.Length == 0) {
No items. Click "Add" to add one.
}
@code { [Parameter] public string[] Items { get; set; } = []; [Parameter] public EventCallback OnItemsChanged { get; set; } [Parameter] public bool IsReadOnly { get; set; } private async Task AddItem() { var newItems = Items.Append("").ToArray(); await OnItemsChanged.InvokeAsync(newItems); } private async Task RemoveItem(int index) { var newItems = Items.Where((_, i) => i != index).ToArray(); await OnItemsChanged.InvokeAsync(newItems); } private async Task UpdateItem(int index, string value) { var newItems = Items.ToArray(); newItems[index] = value; await OnItemsChanged.InvokeAsync(newItems); } } Path: redb/redb.PropsEditor/Components/JsonEditor.razor Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb Page: https://redbase.app/src/dev-2026-12-06/redb/redb.PropsEditor/Components/JsonEditor.razor ---- @using Microsoft.FluentUI.AspNetCore.Components @* Fallback JSON editor for complex types *@
@if (!string.IsNullOrEmpty(errorMessage)) {
@errorMessage
}
@code { [Parameter] public string Value { get; set; } = ""; [Parameter] public EventCallback OnValueChanged { get; set; } [Parameter] public bool IsReadOnly { get; set; } private string? errorMessage; private async Task HandleChange(string value) { errorMessage = null; // Validate JSON try { System.Text.Json.JsonDocument.Parse(value); await OnValueChanged.InvokeAsync(value); } catch (System.Text.Json.JsonException ex) { errorMessage = $"Invalid JSON: {ex.Message}"; } } } Path: redb/redb.PropsEditor/Components/NestedArrayEditor.razor Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb Page: https://redbase.app/src/dev-2026-12-06/redb/redb.PropsEditor/Components/NestedArrayEditor.razor ---- @using redb.PropsEditor.Services @using Microsoft.FluentUI.AspNetCore.Components @inject PropsMetadataService MetadataService @* Renders an array of objects with expandable items *@
@(isExpanded ? "▼" : "▶") @(ElementType.Name)[] (@GetCount() items) @if (!IsReadOnly) { + Add }
@if (isExpanded && items != null) {
@for (var i = 0; i < items.Count; i++) { var index = i; var item = items[index];
[@index]
@if (!IsReadOnly) { X }
}
}
@code { /// /// The element type of the array. /// [Parameter, EditorRequired] public required Type ElementType { get; set; } /// /// The current array value. /// [Parameter] public Array? Value { get; set; } /// /// Called when the value changes. /// [Parameter] public EventCallback OnValueChanged { get; set; } /// /// Whether the editor is read-only. /// [Parameter] public bool IsReadOnly { get; set; } private bool isExpanded = false; private List? items; protected override void OnParametersSet() { if (Value != null) { items = new List(); foreach (var item in Value) { items.Add(item); } } else { items = null; } } private int GetCount() { return items?.Count ?? 0; } private async Task AddItem() { items ??= new List(); try { var newItem = Activator.CreateInstance(ElementType); items.Add(newItem); await NotifyChanged(); } catch { // Cannot create instance } } private async Task RemoveItem(int index) { if (items != null && index >= 0 && index < items.Count) { items.RemoveAt(index); await NotifyChanged(); } } private async Task UpdateItem(int index, object? value) { if (items != null && index >= 0 && index < items.Count) { items[index] = value; await NotifyChanged(); } } private async Task NotifyChanged() { if (items != null) { var array = Array.CreateInstance(ElementType, items.Count); for (var i = 0; i < items.Count; i++) { array.SetValue(items[i], i); } await OnValueChanged.InvokeAsync(array); } else { await OnValueChanged.InvokeAsync(null); } } } Path: redb/redb.PropsEditor/Components/NestedObjectEditor.razor Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb Page: https://redbase.app/src/dev-2026-12-06/redb/redb.PropsEditor/Components/NestedObjectEditor.razor ---- @using redb.PropsEditor.Services @using Microsoft.FluentUI.AspNetCore.Components @inject PropsMetadataService MetadataService @* Renders a nested object with expandable properties *@
@(isExpanded ? "▼" : "▶") @GetTypeName() @if (Value == null) { (null) @if (!IsReadOnly) { Create } }
@if (isExpanded && Value != null) {
@foreach (var prop in GetProperties()) { }
}
@code { /// /// The type of the nested object. /// [Parameter, EditorRequired] public required Type PropertyType { get; set; } /// /// The current value of the object. /// [Parameter] public object? Value { get; set; } /// /// Called when the value changes. /// [Parameter] public EventCallback OnValueChanged { get; set; } /// /// Whether the editor is read-only. /// [Parameter] public bool IsReadOnly { get; set; } private bool isExpanded = false; private string GetTypeName() { return PropertyType.Name; } private IEnumerable GetProperties() { return MetadataService.GetProperties(PropertyType); } private async Task NotifyChanged() { await OnValueChanged.InvokeAsync(Value); } private async Task CreateInstance() { try { Value = Activator.CreateInstance(PropertyType); isExpanded = true; await OnValueChanged.InvokeAsync(Value); } catch { // Cannot create instance } } } Path: redb/redb.PropsEditor/Components/PropertyField.razor Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb Page: https://redbase.app/src/dev-2026-12-06/redb/redb.PropsEditor/Components/PropertyField.razor ---- @using redb.PropsEditor.Services @using System.Text.Json @using Microsoft.FluentUI.AspNetCore.Components @* Renders a single property field based on its type *@ @if (IsComplexType) { @* Vertical layout for arrays and nested objects *@
@Metadata.Label@if (IsRequired) { * }
@RenderEditor()
} else { @* Horizontal layout for simple types *@
@Metadata.Label@if (IsRequired) { * }
@RenderEditor()
} @{ RenderFragment RenderEditor() => __builder => { switch (Metadata.EditorType) { case EditorType.Text: break; case EditorType.TextArea: break; case EditorType.Checkbox: break; case EditorType.Integer: break; case EditorType.Decimal: break; case EditorType.DateTime: break; case EditorType.Enum: @foreach (var name in GetEnumNames()) { @name } break; case EditorType.StringArray: break; case EditorType.Object: @* Nested object - render recursively *@ break; case EditorType.ObjectArray: @* Array of objects - render as expandable list *@ var elementType = Metadata.PropertyType.GetElementType(); if (elementType != null) { } break; case EditorType.PrimitiveArray: case EditorType.Json: break; } @if (!string.IsNullOrEmpty(Metadata.Description)) {
@Metadata.Description
} }; } @code { private bool IsComplexType => Metadata.EditorType is EditorType.Object or EditorType.ObjectArray or EditorType.StringArray or EditorType.PrimitiveArray or EditorType.Json; [Parameter, EditorRequired] public required PropertyMetadata Metadata { get; set; } [Parameter, EditorRequired] public required object Target { get; set; } [Parameter] public EventCallback OnValueChanged { get; set; } /// /// Force this property to be read-only (overrides metadata). /// [Parameter] public bool IsForceReadOnly { get; set; } private bool IsReadOnly => Metadata.IsReadOnly || IsForceReadOnly; private bool IsRequired => !IsNullable(Metadata.PropertyType); private bool IsNullable(Type type) { return !type.IsValueType || Nullable.GetUnderlyingType(type) != null; } private string GetStringValue() { return Metadata.GetValue(Target)?.ToString() ?? ""; } private bool GetBoolValue() { var val = Metadata.GetValue(Target); return val is bool b && b; } private long? GetLongValue() { var val = Metadata.GetValue(Target); return val switch { long l => l, int i => i, short s => s, byte b => b, _ => null }; } private decimal? GetDecimalValue() { var val = Metadata.GetValue(Target); return val switch { decimal d => d, double db => (decimal)db, float f => (decimal)f, _ => null }; } private DateTime? GetDateTimeValue() { var val = Metadata.GetValue(Target); return val switch { DateTime dt => dt, DateTimeOffset dto => dto.DateTime, _ => null }; } private string GetEnumStringValue() { var val = Metadata.GetValue(Target); return val?.ToString() ?? ""; } private string[] GetEnumNames() { var enumType = Nullable.GetUnderlyingType(Metadata.PropertyType) ?? Metadata.PropertyType; return Enum.GetNames(enumType); } private string[] GetStringArray() { var val = Metadata.GetValue(Target); return val as string[] ?? []; } private string GetJsonValue() { var val = Metadata.GetValue(Target); if (val == null) return "null"; try { return JsonSerializer.Serialize(val, new JsonSerializerOptions { WriteIndented = true }); } catch { return "{}"; } } private async Task SetValue(object? value) { Metadata.SetValue(Target, value); await OnValueChanged.InvokeAsync(); } private async Task SetNumericValue(object? value) { var targetType = Nullable.GetUnderlyingType(Metadata.PropertyType) ?? Metadata.PropertyType; object? converted = null; if (value != null) { converted = Convert.ChangeType(value, targetType); } Metadata.SetValue(Target, converted); await OnValueChanged.InvokeAsync(); } private async Task SetEnumValue(string value) { var enumType = Nullable.GetUnderlyingType(Metadata.PropertyType) ?? Metadata.PropertyType; if (Enum.TryParse(enumType, value, out var result)) { Metadata.SetValue(Target, result); await OnValueChanged.InvokeAsync(); } } private async Task SetStringArray(string[] items) { Metadata.SetValue(Target, items); await OnValueChanged.InvokeAsync(); } private async Task SetJsonValue(string json) { try { var val = JsonSerializer.Deserialize(json, Metadata.PropertyType); Metadata.SetValue(Target, val); await OnValueChanged.InvokeAsync(); } catch { // Invalid JSON - don't update } } private async Task SetNestedValue(object? value) { Metadata.SetValue(Target, value); await OnValueChanged.InvokeAsync(); } private async Task SetArrayValue(Array? value) { Metadata.SetValue(Target, value); await OnValueChanged.InvokeAsync(); } } Path: redb/redb.PropsEditor/Components/PropsEditor.razor Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb Page: https://redbase.app/src/dev-2026-12-06/redb/redb.PropsEditor/Components/PropsEditor.razor ---- @using redb.PropsEditor.Services @using Microsoft.FluentUI.AspNetCore.Components @inject PropsMetadataService MetadataService @typeparam TProps where TProps : class @* Universal property editor for any Props class *@
@if (ShowHeader) {
@GetTypeName() @if (ShowSaveButton) { @(IsSaving ? "Saving..." : "Save") }
}
@if (Value == null) {
No data to edit.
} else { @* Group properties by GroupName *@ @foreach (var group in GetGroupedProperties()) { @if (string.IsNullOrEmpty(group.Key)) { @* Properties without group *@ @foreach (var prop in group) { } } else { @* Collapsible group *@ var groupName = group.Key; var isExpanded = !collapsedGroups.Contains(groupName);
@(isExpanded ? "▼" : "▶") @groupName
@if (isExpanded) {
@foreach (var prop in group) { }
}
} } }
@code { /// /// The Props object to edit. /// [Parameter] public TProps? Value { get; set; } /// /// Called when the value changes. /// [Parameter] public EventCallback ValueChanged { get; set; } /// /// Called when Save button is clicked. /// [Parameter] public EventCallback OnSave { get; set; } /// /// Whether to show the Save button. /// [Parameter] public bool ShowSaveButton { get; set; } = true; /// /// Whether to show the header with type name. /// [Parameter] public bool ShowHeader { get; set; } = true; /// /// Whether save is in progress. /// [Parameter] public bool IsSaving { get; set; } /// /// Property names that should be read-only (in addition to [PropsReadOnly] attribute). /// [Parameter] public HashSet? ReadOnlyPropertyNames { get; set; } /// /// If set, only these properties will be shown (whitelist mode). /// [Parameter] public HashSet? OnlyShowProperties { get; set; } private HashSet collapsedGroups = []; private IEnumerable? properties; protected override void OnParametersSet() { properties = MetadataService.GetProperties(); // Initialize collapsed groups foreach (var prop in properties.Where(p => p.GroupCollapsed && !string.IsNullOrEmpty(p.GroupName))) { collapsedGroups.Add(prop.GroupName!); } } private string GetTypeName() { return typeof(TProps).Name; } private IEnumerable> GetGroupedProperties() { var filtered = properties ?? []; // Whitelist mode - show only specified properties if (OnlyShowProperties?.Count > 0) { filtered = filtered.Where(p => OnlyShowProperties.Contains(p.Name)); } return filtered .GroupBy(p => p.GroupName) .OrderBy(g => string.IsNullOrEmpty(g.Key) ? 0 : 1) .ThenBy(g => g.Key); } private void ToggleGroup(string groupName) { if (collapsedGroups.Contains(groupName)) collapsedGroups.Remove(groupName); else collapsedGroups.Add(groupName); } private async Task HandlePropertyChanged() { if (Value != null) { await ValueChanged.InvokeAsync(Value); } } private async Task HandleSave() { await OnSave.InvokeAsync(); } private bool IsPropertyReadOnly(string propertyName) { return ReadOnlyPropertyNames?.Contains(propertyName) == true; } } Path: redb/redb.PropsEditor/Components/PropsGrid.razor Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb Page: https://redbase.app/src/dev-2026-12-06/redb/redb.PropsEditor/Components/PropsGrid.razor ---- @using redb.Core @using redb.Core.Models.Entities @using redb.PropsEditor.Services @using Microsoft.FluentUI.AspNetCore.Components @inject IRedbService Redb @inject PropsMetadataService MetadataService @typeparam TProps where TProps : class, new() @* Grid view with CRUD operations for any Props type *@

@GetTypeName()

+ New Refresh
@if (loading) {

Loading...

} else if (items.Count == 0) {
No items found. Click "+ New" to create one.
} else { @foreach (var prop in GetDisplayProperties().Take(3)) { @GetDisplayValue(context, prop) } }
@* Edit Dialog *@ @code { private List> items = []; private List> filteredItems = []; private bool loading = true; private bool dialogHidden = true; private bool saving; private string searchText = ""; private FluentDialog? editDialog; private RedbObject? editingItem; protected override async Task OnInitializedAsync() { await LoadData(); } private async Task LoadData() { loading = true; try { items = await Redb.Query() .OrderByDescendingRedb(x => x.DateModify) .Take(1000) .ToListAsync(); ApplyFilter(); } catch (Exception ex) { Console.WriteLine($"Error loading data: {ex.Message}"); items = []; } finally { loading = false; } } private void HandleSearch() { ApplyFilter(); } private void ApplyFilter() { if (string.IsNullOrWhiteSpace(searchText)) { filteredItems = items; } else { var search = searchText.ToLowerInvariant(); filteredItems = items .Where(x => x.name?.ToLowerInvariant().Contains(search) == true) .ToList(); } } private string GetTypeName() => typeof(TProps).Name; private IEnumerable GetDisplayProperties() { return MetadataService.GetProperties() .Where(p => p.EditorType is EditorType.Text or EditorType.Checkbox or EditorType.Integer or EditorType.Decimal) .Take(5); } private string GetDisplayValue(RedbObject item, PropertyMetadata prop) { var val = prop.GetValue(item.Props); if (val == null) return "-"; if (val is bool b) return b ? "Yes" : "No"; var str = val.ToString() ?? ""; return str.Length > 50 ? str[..50] + "..." : str; } private void ShowCreateDialog() { editingItem = new RedbObject { Props = new TProps() }; dialogHidden = false; } private void ShowEditDialog(RedbObject item) { // Clone the entire object for editing var json = System.Text.Json.JsonSerializer.Serialize(item); editingItem = System.Text.Json.JsonSerializer.Deserialize>(json); dialogHidden = false; } private async Task SaveItem() { if (editingItem == null) return; saving = true; try { // Auto-set name from Name/Title property if not set if (string.IsNullOrEmpty(editingItem.name)) { var nameProperty = MetadataService.GetProperties() .FirstOrDefault(p => p.Name.Equals("Name", StringComparison.OrdinalIgnoreCase) || p.Name.Equals("Title", StringComparison.OrdinalIgnoreCase)); if (nameProperty != null) { editingItem.name = nameProperty.GetValue(editingItem.Props)?.ToString(); } } await Redb.SaveAsync(editingItem); dialogHidden = true; await LoadData(); } catch (Exception ex) { Console.WriteLine($"Error saving: {ex.Message}"); } finally { saving = false; } } private async Task DeleteItem(RedbObject item) { try { await Redb.DeleteAsync(item); await LoadData(); } catch (Exception ex) { Console.WriteLine($"Error deleting: {ex.Message}"); } } private void CloseDialog() { dialogHidden = true; editingItem = null; } } Path: redb/redb.PropsEditor/Components/RedbObjectEditor.razor Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb Page: https://redbase.app/src/dev-2026-12-06/redb/redb.PropsEditor/Components/RedbObjectEditor.razor ---- @using redb.Core @using redb.Core.Models.Entities @using redb.PropsEditor.Services @using Microsoft.FluentUI.AspNetCore.Components @inject PropsMetadataService MetadataService @typeparam TProps where TProps : class, new() @* Full RedbObject editor with base fields + Props *@

@GetTypeName()

@if (ShowSaveButton) { @(IsSaving ? "Saving..." : "Save") }
@if (Value == null) {
No data to edit.
} else { @* Base Fields Section *@
@(baseFieldsCollapsed ? "▶" : "▼") Base Fields RedbObject
@if (!baseFieldsCollapsed) {
@* ID - read only *@
ID
@if (IsNew) { (New - auto) } else { }
@* name *@
name
@* value_string *@
value_string
@* value_long *@
value_long
@* parent_id *@
parent_id
@* key *@
key
@* note *@
note
@* Dates - read only *@ @if (!IsNew) {
date_create
@Value.date_create.ToString("yyyy-MM-dd HH:mm:ss")
date_modify
@Value.date_modify.ToString("yyyy-MM-dd HH:mm:ss")
}
}
@* Props Section *@
@(propsCollapsed ? "▶" : "▼") Properties @GetTypeName()
@if (!propsCollapsed) {
@foreach (var group in GetGroupedProperties()) { @if (string.IsNullOrEmpty(group.Key)) { @foreach (var prop in group) { } } else { var groupName = group.Key; var isExpanded = !collapsedGroups.Contains(groupName);
@(isExpanded ? "▼" : "▶") @groupName
@if (isExpanded) {
@foreach (var prop in group) { }
}
} }
}
}
@code { /// /// The RedbObject to edit. /// [Parameter] public RedbObject? Value { get; set; } /// /// Called when any value changes. /// [Parameter] public EventCallback> ValueChanged { get; set; } /// /// Called when Save button is clicked. /// [Parameter] public EventCallback OnSave { get; set; } /// /// Whether to show the Save button. /// [Parameter] public bool ShowSaveButton { get; set; } = true; /// /// Whether save is in progress. /// [Parameter] public bool IsSaving { get; set; } private bool baseFieldsCollapsed = false; private bool propsCollapsed = false; private HashSet collapsedGroups = []; private IEnumerable? properties; private bool IsNew => Value?.id == 0; protected override void OnParametersSet() { properties = MetadataService.GetProperties(); foreach (var prop in properties.Where(p => p.GroupCollapsed && !string.IsNullOrEmpty(p.GroupName))) { collapsedGroups.Add(prop.GroupName!); } } private string GetTypeName() => typeof(TProps).Name; private IEnumerable> GetGroupedProperties() { return properties? .GroupBy(p => p.GroupName) .OrderBy(g => string.IsNullOrEmpty(g.Key) ? 0 : 1) .ThenBy(g => g.Key) ?? Enumerable.Empty>(); } private void ToggleGroup(string groupName) { if (collapsedGroups.Contains(groupName)) collapsedGroups.Remove(groupName); else collapsedGroups.Add(groupName); } private async Task NotifyChanged() { if (Value != null) { await ValueChanged.InvokeAsync(Value); } } private async Task HandleSave() { await OnSave.InvokeAsync(); } } Path: redb/redb.PropsEditor/Components/SchemeBrowser.razor Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb Page: https://redbase.app/src/dev-2026-12-06/redb/redb.PropsEditor/Components/SchemeBrowser.razor ---- @using Microsoft.FluentUI.AspNetCore.Components @* Displays list of available Props types for editing *@

Available Schemes

Select a Props type to manage. Use PropsGrid component with specific TProps type.

@if (Schemes.Count == 0) {
No schemes configured. Add scheme cards to display available types.
} else {
@foreach (var scheme in Schemes) {

@scheme.Name

@if (!string.IsNullOrEmpty(scheme.Description)) {
@scheme.Description
} Manage
}
}
@code { /// /// List of available schemes to display. /// [Parameter] public List Schemes { get; set; } = []; /// /// Called when a scheme is selected. /// [Parameter] public EventCallback OnSchemeSelected { get; set; } /// /// Information about a Props scheme. /// public class SchemeInfo { public required string Name { get; init; } public string? Description { get; init; } } } Path: redb/redb.PropsEditor/Extensions/ServiceCollectionExtensions.cs Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb Page: https://redbase.app/src/dev-2026-12-06/redb/redb.PropsEditor/Extensions/ServiceCollectionExtensions.cs ---- using Microsoft.Extensions.DependencyInjection; using redb.PropsEditor.Services; namespace redb.PropsEditor.Extensions; /// /// Extension methods for registering redb.PropsEditor services. /// public static class ServiceCollectionExtensions { /// /// Adds redb.PropsEditor services to the service collection. /// /// /// builder.Services.AddRedbPropsEditor(); /// public static IServiceCollection AddRedbPropsEditor(this IServiceCollection services) { services.AddScoped(); return services; } } Path: redb/redb.PropsEditor/README.md Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb Page: https://redbase.app/src/dev-2026-12-06/redb/redb.PropsEditor/README.md ---- # redb.PropsEditor Blazor component library for editing REDB object properties. Built with [Fluent UI Blazor](https://www.fluentui-blazor.net/). [![License: Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-blue)](../LICENSE) ## Components | Component | Description | |-----------|-------------| | `PropsEditor` | Full property editor for a `RedbObject` | | `PropsGrid` | Grid view of Props fields with inline editing | | `RedbObjectEditor` | Editor for base object fields (Name, ValueString, etc.) | | `SchemeBrowser` | Browse and select REDB schemes | | `PropertyField` | Single property field editor (auto-selects input type) | | `ArrayEditor` | Editor for array/list properties | | `JsonEditor` | Raw JSON editor for complex properties | | `NestedObjectEditor` | Editor for nested object properties | | `NestedArrayEditor` | Editor for arrays of nested objects | ## Installation Add a project reference: ```xml ``` Add to `_Imports.razor`: ```razor @using redb.PropsEditor.Components ``` ## Dependencies - `redb.Core` - `Microsoft.AspNetCore.Components.Web` - `Microsoft.FluentUI.AspNetCore.Components` ## Links - Documentation (EN): [redbase.app](https://redbase.app) - Documentation (RU): [redb.ru](https://redb.ru) - API Reference: [redbase-app.github.io/redb](https://redbase-app.github.io/redb/) - GitHub: [github.com/redbase-app/redb](https://github.com/redbase-app/redb) ## License Apache License 2.0 — see [LICENSE](https://github.com/redbase-app/redb/blob/main/LICENSE). Path: redb/redb.PropsEditor/Services/PropsMetadataService.cs Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb Page: https://redbase.app/src/dev-2026-12-06/redb/redb.PropsEditor/Services/PropsMetadataService.cs ---- using System.Reflection; using redb.PropsEditor.Attributes; namespace redb.PropsEditor.Services; /// /// Provides metadata about Props classes for dynamic UI generation. /// Uses reflection to analyze property types and attributes. /// public class PropsMetadataService { /// /// Gets metadata for all properties of a Props type. /// public IEnumerable GetProperties() where TProps : class { return GetProperties(typeof(TProps)); } /// /// Gets metadata for all properties of a Props type. /// public IEnumerable GetProperties(Type propsType) { var properties = propsType.GetProperties(BindingFlags.Public | BindingFlags.Instance) .Where(p => p.CanRead && p.CanWrite) .Where(p => p.GetCustomAttribute() == null) .Select(CreateMetadata) .OrderBy(m => m.Order) .ThenBy(m => m.Label); return properties; } private PropertyMetadata CreateMetadata(PropertyInfo prop) { var displayAttr = prop.GetCustomAttribute(); var textAreaAttr = prop.GetCustomAttribute(); var groupAttr = prop.GetCustomAttribute(); var readOnlyAttr = prop.GetCustomAttribute(); return new PropertyMetadata { PropertyInfo = prop, Name = prop.Name, Label = displayAttr?.Label ?? FormatLabel(prop.Name), Placeholder = displayAttr?.Placeholder, Description = displayAttr?.Description, Order = displayAttr?.Order ?? 0, GroupName = groupAttr?.GroupName, GroupCollapsed = groupAttr?.Collapsed ?? false, IsReadOnly = readOnlyAttr != null, IsTextArea = textAreaAttr != null, TextAreaRows = textAreaAttr?.Rows ?? 4, PropertyType = prop.PropertyType, EditorType = DetermineEditorType(prop) }; } private EditorType DetermineEditorType(PropertyInfo prop) { var type = prop.PropertyType; var underlyingType = Nullable.GetUnderlyingType(type) ?? type; // Check for TextArea attribute first if (prop.GetCustomAttribute() != null) return EditorType.TextArea; // String if (underlyingType == typeof(string)) return EditorType.Text; // Boolean if (underlyingType == typeof(bool)) return EditorType.Checkbox; // Numeric types if (underlyingType == typeof(int) || underlyingType == typeof(long) || underlyingType == typeof(short) || underlyingType == typeof(byte)) return EditorType.Integer; if (underlyingType == typeof(decimal) || underlyingType == typeof(double) || underlyingType == typeof(float)) return EditorType.Decimal; // DateTime if (underlyingType == typeof(DateTime) || underlyingType == typeof(DateTimeOffset)) return EditorType.DateTime; // Enum if (underlyingType.IsEnum) return EditorType.Enum; // Arrays if (type.IsArray) { var elementType = type.GetElementType()!; if (elementType == typeof(string)) return EditorType.StringArray; if (elementType.IsPrimitive || elementType == typeof(decimal)) return EditorType.PrimitiveArray; return EditorType.ObjectArray; } // Complex object if (underlyingType.IsClass && underlyingType != typeof(string)) return EditorType.Object; // Fallback to JSON return EditorType.Json; } private static string FormatLabel(string propertyName) { // Convert PascalCase to "Pascal Case" var chars = new List(); foreach (var c in propertyName) { if (chars.Count > 0 && char.IsUpper(c)) chars.Add(' '); chars.Add(c); } return new string(chars.ToArray()); } } /// /// Metadata about a single property for UI rendering. /// public class PropertyMetadata { public required PropertyInfo PropertyInfo { get; init; } public required string Name { get; init; } public required string Label { get; init; } public string? Placeholder { get; init; } public string? Description { get; init; } public int Order { get; init; } public string? GroupName { get; init; } public bool GroupCollapsed { get; init; } public bool IsReadOnly { get; init; } public bool IsTextArea { get; init; } public int TextAreaRows { get; init; } public required Type PropertyType { get; init; } public EditorType EditorType { get; init; } /// /// Gets the value of this property from an object. /// public object? GetValue(object obj) => PropertyInfo.GetValue(obj); /// /// Sets the value of this property on an object. /// public void SetValue(object obj, object? value) => PropertyInfo.SetValue(obj, value); } /// /// Type of editor to render for a property. /// public enum EditorType { Text, TextArea, Checkbox, Integer, Decimal, DateTime, Enum, StringArray, PrimitiveArray, ObjectArray, Object, Json } Path: redb/redb.PropsEditor/_Imports.razor Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb Page: https://redbase.app/src/dev-2026-12-06/redb/redb.PropsEditor/_Imports.razor ---- @using Microsoft.AspNetCore.Components.Web @using Microsoft.FluentUI.AspNetCore.Components @using redb.Core @using redb.Core.Models.Entities @using redb.PropsEditor.Services @using redb.PropsEditor.Attributes @using redb.PropsEditor.Components Path: redb/redb.PropsEditor/redb.PropsEditor.csproj Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb Page: https://redbase.app/src/dev-2026-12-06/redb/redb.PropsEditor/redb.PropsEditor.csproj ---- net10.0 enable enable 12 https://github.com/redbase-app/redb Path: redb/redb.PropsEditor/wwwroot/redb.PropsEditor.css Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb Page: https://redbase.app/src/dev-2026-12-06/redb/redb.PropsEditor/wwwroot/redb.PropsEditor.css ---- /* redb.PropsEditor styles - VS Property Grid style */ /* Global editor container */ .props-editor-container { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-size: 13px; min-width: 450px; } /* Array editor - compact style */ .array-editor { width: 100%; border: 1px solid #e5e5e5; background: #fafafa; } .array-editor-header { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px; background: #f0f0f0; border-bottom: 1px solid #e5e5e5; font-size: 11px; } .array-item { display: flex; align-items: center; gap: 4px; padding: 2px 4px; border-bottom: 1px solid #f0f0f0; } .array-item:last-child { border-bottom: none; } .array-item-index { color: #888; font-size: 11px; min-width: 24px; text-align: right; } .array-item-value { flex: 1; } .array-item-remove { cursor: pointer; color: #c42b1c; font-size: 11px; padding: 2px 4px; } .array-item-remove:hover { background: #fde7e9; } /* Object editor */ .object-editor { width: 100%; border: 1px solid #e5e5e5; background: #fafafa; padding: 4px; } /* JSON editor */ .json-editor { width: 100%; } .json-editor textarea { font-family: 'Cascadia Code', 'Consolas', 'Monaco', monospace; font-size: 12px; } /* Props grid - list view */ .props-grid { background: #fff; border: 1px solid #d4d4d4; } .props-grid-header { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid #d4d4d4; background: #f3f3f3; } .props-grid-header h3 { margin: 0; font-size: 14px; font-weight: 600; } .props-grid-toolbar { display: flex; gap: 8px; } .props-grid-search { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: #fafafa; border-bottom: 1px solid #e5e5e5; } /* Scheme browser */ .scheme-browser { padding: 16px; } .scheme-browser h2 { margin: 0 0 8px; font-size: 18px; } .scheme-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 16px; } .scheme-card { background: #fff; border: 1px solid #d4d4d4; padding: 12px; transition: border-color 0.15s; } .scheme-card:hover { border-color: #0078d4; } .scheme-card h4 { margin: 0 0 8px; font-size: 13px; font-weight: 600; } .scheme-card .count { color: #666; font-size: 12px; margin-bottom: 8px; } /* Props Edit Dialog - override FluentUI defaults */ .props-edit-dialog { --dialog-width: 650px; --dialog-height: auto; } .props-edit-dialog::part(control) { width: 650px; max-width: 90vw; max-height: 90vh; } .props-edit-dialog fluent-dialog-body { width: 100%; min-width: 550px; } /* Ensure dialog content is wide enough */ fluent-dialog.props-edit-dialog { --dialog-width: 650px; } /* Override cursor for readonly fields - use normal text cursor, not "not-allowed" */ fluent-text-field[readonly], fluent-text-area[readonly], fluent-number-field[readonly], fluent-checkbox[readonly] { cursor: text; } fluent-text-field[readonly]::part(root), fluent-text-field[readonly]::part(control), fluent-text-area[readonly]::part(root), fluent-text-area[readonly]::part(control), fluent-number-field[readonly]::part(root), fluent-number-field[readonly]::part(control) { cursor: text; } fluent-checkbox[readonly]::part(control) { cursor: default; }