mirror of
https://github.com/radzenhq/radzen-blazor.git
synced 2026-07-08 18:16:08 +00:00
Mirror the spreadsheet grid in right-to-left layouts: column A on the right, columns flowing leftward, row headers and the vertical scrollbar on the left. All direction logic lives in JS and CSS; the C# render path stays direction-agnostic: - Position cells, headers and overlays with logical insets (inset-inline-start / inset-block-start) instead of transform: translate, so the browser mirrors the grid using the unchanged logical coordinates. - Mirror pointer clientX/offsetX and normalize scrollLeft in JS so the existing C# pointer and scroll math need no changes. - Convert physical CSS (borders, text-align, chevron, validation triangle, resize cursors) to logical properties; flip the merged/active-cell selection mask via a [dir=rtl] rule.
44 lines
1.7 KiB
C#
44 lines
1.7 KiB
C#
using System.Diagnostics.CodeAnalysis;
|
|
using Microsoft.AspNetCore.Components;
|
|
using Radzen.Blazor.Rendering;
|
|
|
|
using Radzen.Documents.Spreadsheet;
|
|
namespace Radzen.Blazor.Spreadsheet;
|
|
|
|
#nullable enable
|
|
|
|
/// <summary>
|
|
/// Renders a row header in a spreadsheet.
|
|
/// </summary>
|
|
public partial class RowHeader : HeaderBase
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the row index for the row header.
|
|
/// </summary>
|
|
[Parameter]
|
|
public int Row { get; set; }
|
|
|
|
/// <inheritdoc/>
|
|
protected override int Index => Row;
|
|
|
|
/// <inheritdoc/>
|
|
protected override string IndexParameterName => nameof(Row);
|
|
|
|
/// <inheritdoc/>
|
|
[SuppressMessage("Design", "CA1062", Justification = "Base class guarantees non-null.")]
|
|
protected override bool CheckIsActive(Selection selection) => selection.IsActive(new RowRef(Row));
|
|
|
|
/// <inheritdoc/>
|
|
[SuppressMessage("Design", "CA1062", Justification = "Base class guarantees non-null.")]
|
|
protected override bool CheckIsSelected(Selection selection) => selection.IsSelected(new RowRef(Row));
|
|
|
|
private string Class => ClassList.Create("rz-spreadsheet-row-header")
|
|
.Add("rz-spreadsheet-frozen-row", FrozenState.HasFlag(FrozenState.Row))
|
|
.Add("rz-spreadsheet-frozen-column", FrozenState.HasFlag(FrozenState.Column))
|
|
.Add("rz-spreadsheet-header-active", Active)
|
|
.Add("rz-spreadsheet-header-selected", Selected)
|
|
.ToString();
|
|
|
|
private string ResizeHandleStyle => $"inset-block-start: {Rect.Bottom.ToPx()}; inset-inline-start: {Rect.Left.ToPx()}; width: {Rect.Width.ToPx()};";
|
|
}
|