Tighten tables layout and grid behavior
This commit is contained in:
@@ -44,7 +44,7 @@
|
||||
<div class="critical-table-cell-actions">
|
||||
@if (string.Equals(CurrentMode, TablesReferenceMode.Reference, StringComparison.Ordinal))
|
||||
{
|
||||
<StatusIndicator Tone="@(cell.IsCurated ? "success" : "warning")" CssClass="tables-cell-status-indicator" />
|
||||
<StatusIndicator Tone="@(cell.IsCurated ? "success" : "warning")" CssClass="tables-cell-status-indicator"/>
|
||||
}
|
||||
else if (cell.IsCurated)
|
||||
{
|
||||
@@ -64,7 +64,7 @@
|
||||
<CompactCriticalCell
|
||||
Description="@(cell.Description ?? string.Empty)"
|
||||
Effects="@(cell.Effects ?? Array.Empty<CriticalEffectLookupResponse>())"
|
||||
Branches="@(cell.Branches ?? Array.Empty<CriticalBranchLookupResponse>())" />
|
||||
Branches="@(cell.Branches ?? Array.Empty<CriticalBranchLookupResponse>())"/>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -170,66 +170,60 @@
|
||||
cellIndex.TryGetValue((rollBand, groupKey, columnKey), out cell);
|
||||
|
||||
private bool MatchesGroupFilter(CriticalGroupReference group) =>
|
||||
string.IsNullOrWhiteSpace(SelectedGroupKey)
|
||||
|| string.Equals(group.Key, SelectedGroupKey, StringComparison.OrdinalIgnoreCase);
|
||||
string.IsNullOrWhiteSpace(SelectedGroupKey) || string.Equals(group.Key, SelectedGroupKey, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
private bool MatchesColumnFilter(CriticalColumnReference column) =>
|
||||
string.IsNullOrWhiteSpace(SelectedColumnKey)
|
||||
|| string.Equals(column.Key, SelectedColumnKey, StringComparison.OrdinalIgnoreCase);
|
||||
string.IsNullOrWhiteSpace(SelectedColumnKey) || string.Equals(column.Key, SelectedColumnKey, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
private IReadOnlyList<CriticalGroupReference> ResolveVisibleGroups()
|
||||
{
|
||||
var filteredGroups = Detail.Groups
|
||||
.Where(MatchesGroupFilter)
|
||||
.ToList();
|
||||
var filteredGroups = Detail.Groups.Where(MatchesGroupFilter).ToList();
|
||||
|
||||
return filteredGroups.Count > 0
|
||||
? filteredGroups
|
||||
: Detail.Groups;
|
||||
return filteredGroups.Count > 0 ? filteredGroups : Detail.Groups;
|
||||
}
|
||||
|
||||
private IReadOnlyList<CriticalColumnReference> ResolveVisibleColumns()
|
||||
{
|
||||
var filteredColumns = Detail.Columns
|
||||
.Where(MatchesColumnFilter)
|
||||
.ToList();
|
||||
var filteredColumns = Detail.Columns.Where(MatchesColumnFilter).ToList();
|
||||
|
||||
return filteredColumns.Count > 0
|
||||
? filteredColumns
|
||||
: Detail.Columns;
|
||||
return filteredColumns.Count > 0 ? filteredColumns : Detail.Columns;
|
||||
}
|
||||
|
||||
private bool MatchesModeFilter(CriticalTableCellDetail cell) =>
|
||||
CurrentMode switch
|
||||
{
|
||||
TablesReferenceMode.NeedsCuration => !cell.IsCurated,
|
||||
TablesReferenceMode.Curated => cell.IsCurated,
|
||||
_ => true
|
||||
TablesReferenceMode.Curated => cell.IsCurated,
|
||||
_ => true
|
||||
};
|
||||
|
||||
private string? ActiveRollBand =>
|
||||
!string.IsNullOrWhiteSpace(SelectedCell?.RollBand)
|
||||
? SelectedCell.RollBand
|
||||
: ResolveRollJumpBandLabel();
|
||||
!string.IsNullOrWhiteSpace(SelectedCell?.RollBand) ? SelectedCell.RollBand : ResolveRollJumpBandLabel();
|
||||
|
||||
private string? ActiveColumnKey =>
|
||||
!string.IsNullOrWhiteSpace(SelectedCell?.ColumnKey)
|
||||
? SelectedCell.ColumnKey
|
||||
: (!string.IsNullOrWhiteSpace(SelectedColumnKey) ? SelectedColumnKey : null);
|
||||
!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);
|
||||
!string.IsNullOrWhiteSpace(SelectedCell?.GroupKey) ? SelectedCell.GroupKey : (!string.IsNullOrWhiteSpace(SelectedGroupKey) ? SelectedGroupKey : null);
|
||||
|
||||
private string BuildGridCssClass() =>
|
||||
string.Equals(DensityMode, TablesDensityMode.Dense, StringComparison.Ordinal)
|
||||
? "is-dense"
|
||||
: "is-comfortable";
|
||||
private string BuildGridCssClass()
|
||||
{
|
||||
var classes = new List<string>
|
||||
{
|
||||
string.Equals(DensityMode, TablesDensityMode.Dense, StringComparison.Ordinal) ? "is-dense" : "is-comfortable",
|
||||
Detail.Groups.Count > 0 ? "has-groups" : "has-no-groups"
|
||||
};
|
||||
|
||||
return string.Join(' ', classes);
|
||||
}
|
||||
|
||||
private string BuildGroupHeaderCssClass(string groupKey)
|
||||
{
|
||||
var classes = new List<string> { "critical-table-grid-header-cell", "critical-table-grid-group-header" };
|
||||
var classes = new List<string>
|
||||
{
|
||||
"critical-table-grid-header-cell",
|
||||
"critical-table-grid-group-header"
|
||||
};
|
||||
if (string.Equals(groupKey, ActiveGroupKey, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
classes.Add("is-active-group");
|
||||
@@ -240,15 +234,18 @@
|
||||
|
||||
private string BuildColumnHeaderCssClass(string? groupKey, string columnKey)
|
||||
{
|
||||
var classes = new List<string> { "critical-table-grid-header-cell", "critical-table-grid-column-header" };
|
||||
var classes = new List<string>
|
||||
{
|
||||
"critical-table-grid-header-cell",
|
||||
"critical-table-grid-column-header"
|
||||
};
|
||||
|
||||
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");
|
||||
}
|
||||
@@ -258,7 +255,11 @@
|
||||
|
||||
private string BuildRollBandCssClass(string rollBandLabel)
|
||||
{
|
||||
var classes = new List<string> { "critical-table-grid-header-cell", "critical-table-grid-roll-band" };
|
||||
var classes = new List<string>
|
||||
{
|
||||
"critical-table-grid-header-cell",
|
||||
"critical-table-grid-roll-band"
|
||||
};
|
||||
if (string.Equals(rollBandLabel, ActiveRollBand, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
classes.Add("is-active-row");
|
||||
@@ -290,8 +291,7 @@
|
||||
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");
|
||||
}
|
||||
@@ -340,9 +340,7 @@
|
||||
|
||||
private Task HandleCellKeyDown(KeyboardEventArgs args, CriticalTableCellDetail cell)
|
||||
{
|
||||
if (string.Equals(args.Key, "Enter", StringComparison.Ordinal) ||
|
||||
string.Equals(args.Key, " ", StringComparison.Ordinal) ||
|
||||
string.Equals(args.Key, "Spacebar", StringComparison.Ordinal))
|
||||
if (string.Equals(args.Key, "Enter", StringComparison.Ordinal) || string.Equals(args.Key, " ", StringComparison.Ordinal) || string.Equals(args.Key, "Spacebar", StringComparison.Ordinal))
|
||||
{
|
||||
return SelectCell(cell);
|
||||
}
|
||||
@@ -351,4 +349,4 @@
|
||||
}
|
||||
|
||||
private static string BuildColumnSpanStyle(int span) => $"grid-column: span {span};";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user