Harden shell and tables interactions

This commit is contained in:
2026-04-12 22:38:18 +02:00
parent 222abc155b
commit 0dd1f42fac
18 changed files with 299 additions and 664 deletions

View File

@@ -42,7 +42,7 @@
@onkeydown="args => HandleCellKeyDown(args, cell)">
<div class="critical-table-cell-shell">
<div class="critical-table-cell-actions">
@if (string.Equals(CurrentMode, TablesReferenceMode.Reference, StringComparison.Ordinal))
@if (isReferenceMode)
{
<StatusIndicator Tone="@(cell.IsCurated ? "success" : "warning")" CssClass="tables-cell-status-indicator"/>
}
@@ -92,6 +92,11 @@
private readonly List<CriticalGroupReference> visibleGroups = new();
private readonly List<CriticalColumnReference> visibleColumns = new();
private string gridTemplateStyle = string.Empty;
private bool isReferenceMode;
private string? activeRollBand;
private string? activeColumnKey;
private string? activeGroupKey;
private string? rollJumpBandLabel;
[Parameter, EditorRequired]
public CriticalTableDetail Detail { get; set; } = default!;
@@ -123,6 +128,11 @@
displayColumns.Clear();
visibleGroups.Clear();
visibleColumns.Clear();
isReferenceMode = string.Equals(CurrentMode, TablesReferenceMode.Reference, StringComparison.Ordinal);
rollJumpBandLabel = ResolveRollJumpBandLabel();
activeRollBand = !string.IsNullOrWhiteSpace(SelectedCell?.RollBand) ? SelectedCell.RollBand : rollJumpBandLabel;
activeColumnKey = !string.IsNullOrWhiteSpace(SelectedCell?.ColumnKey) ? SelectedCell.ColumnKey : (!string.IsNullOrWhiteSpace(SelectedColumnKey) ? SelectedColumnKey : null);
activeGroupKey = !string.IsNullOrWhiteSpace(SelectedCell?.GroupKey) ? SelectedCell.GroupKey : (!string.IsNullOrWhiteSpace(SelectedGroupKey) ? SelectedGroupKey : null);
foreach (var cell in Detail.Cells)
{
@@ -197,15 +207,6 @@
_ => true
};
private string? ActiveRollBand =>
!string.IsNullOrWhiteSpace(SelectedCell?.RollBand) ? SelectedCell.RollBand : ResolveRollJumpBandLabel();
private string? ActiveColumnKey =>
!string.IsNullOrWhiteSpace(SelectedCell?.ColumnKey) ? SelectedCell.ColumnKey : (!string.IsNullOrWhiteSpace(SelectedColumnKey) ? SelectedColumnKey : null);
private string? ActiveGroupKey =>
!string.IsNullOrWhiteSpace(SelectedCell?.GroupKey) ? SelectedCell.GroupKey : (!string.IsNullOrWhiteSpace(SelectedGroupKey) ? SelectedGroupKey : null);
private string BuildGridCssClass()
{
var classes = new List<string>
@@ -224,7 +225,7 @@
"critical-table-grid-header-cell",
"critical-table-grid-group-header"
};
if (string.Equals(groupKey, ActiveGroupKey, StringComparison.OrdinalIgnoreCase))
if (string.Equals(groupKey, activeGroupKey, StringComparison.OrdinalIgnoreCase))
{
classes.Add("is-active-group");
}
@@ -240,12 +241,12 @@
"critical-table-grid-column-header"
};
if (string.Equals(columnKey, ActiveColumnKey, StringComparison.OrdinalIgnoreCase))
if (string.Equals(columnKey, activeColumnKey, StringComparison.OrdinalIgnoreCase))
{
classes.Add("is-active-column");
}
if (!string.IsNullOrWhiteSpace(groupKey) && string.Equals(groupKey, ActiveGroupKey, StringComparison.OrdinalIgnoreCase))
if (!string.IsNullOrWhiteSpace(groupKey) && string.Equals(groupKey, activeGroupKey, StringComparison.OrdinalIgnoreCase))
{
classes.Add("is-active-group");
}
@@ -260,12 +261,12 @@
"critical-table-grid-header-cell",
"critical-table-grid-roll-band"
};
if (string.Equals(rollBandLabel, ActiveRollBand, StringComparison.OrdinalIgnoreCase))
if (string.Equals(rollBandLabel, activeRollBand, StringComparison.OrdinalIgnoreCase))
{
classes.Add("is-active-row");
}
if (string.Equals(rollBandLabel, ResolveRollJumpBandLabel(), StringComparison.OrdinalIgnoreCase))
if (string.Equals(rollBandLabel, rollJumpBandLabel, StringComparison.OrdinalIgnoreCase))
{
classes.Add("is-roll-target");
}
@@ -281,17 +282,17 @@
cell.IsCurated ? "is-curated" : "needs-curation"
};
if (string.Equals(cell.RollBand, ActiveRollBand, StringComparison.OrdinalIgnoreCase))
if (string.Equals(cell.RollBand, activeRollBand, StringComparison.OrdinalIgnoreCase))
{
classes.Add("is-active-row");
}
if (string.Equals(cell.ColumnKey, ActiveColumnKey, StringComparison.OrdinalIgnoreCase))
if (string.Equals(cell.ColumnKey, activeColumnKey, StringComparison.OrdinalIgnoreCase))
{
classes.Add("is-active-column");
}
if (!string.IsNullOrWhiteSpace(groupKey) && string.Equals(groupKey, ActiveGroupKey, StringComparison.OrdinalIgnoreCase))
if (!string.IsNullOrWhiteSpace(groupKey) && string.Equals(groupKey, activeGroupKey, StringComparison.OrdinalIgnoreCase))
{
classes.Add("is-active-group");
}
@@ -301,7 +302,7 @@
classes.Add("is-selected-cell");
}
if (string.Equals(cell.RollBand, ResolveRollJumpBandLabel(), StringComparison.OrdinalIgnoreCase))
if (string.Equals(cell.RollBand, rollJumpBandLabel, StringComparison.OrdinalIgnoreCase))
{
classes.Add("is-roll-target");
}