More text positions and per-text styling to the bar texts of BitResourceTimeline

已关闭
#15,441 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@msynk 已经在做这个了。

开始于 2026年11月22日。

  • #15442 来自 @msynk —— 已合并

评估

这个 Issue 还没有评估数据。

描述

area / BlazorUI

Summary

A BitResourceTimelineAllocation can label its bar only on four sides (TextAbove, TextBelow, TextStart, TextEnd), always centered above/below the bar, and always in the timeline's bar-label color and font. Scheduling UIs often need more than that: a flight number at the start of the bar and its status at the end, a gate under one corner, a warning in red, a code in bold.

Proposal

Replace the four string properties of BitResourceTimelineAllocation with one Texts property of a new BitResourceTimelineBarTexts type, which has a property per position:

  • TopStart, TopCenter, TopEnd: above the bar, aligned with its start edge, centered on it, or aligned with its end edge
  • BottomStart, BottomCenter, BottomEnd: the same below the bar
  • Start, End: beside the bar, on its center line (where TextStart / TextEnd are drawn today)

Each position is a new BitResourceTimelineBarText that carries what customizes the text:

  • Text: the value
  • Color: a CSS color (falls back to the bar-label color)
  • Font: a CSS font shorthand (falls back to Options.BarLabelFont or the theme's font)
  • OffsetX / OffsetY: pixels to move the text from where its position puts it

A string converts to a BitResourceTimelineBarText implicitly, so the common case stays short:

new BitResourceTimelineAllocation
{
    Id = "BA117",
    ResourceId = "A1",
    StartTime = start,
    EndTime = end,
    Texts = new()
    {
        TopStart = "BA117",
        TopEnd = new() { Text = "On time", Color = "#2f9e44", Font = "600 11px sans-serif" },
        BottomStart = new() { Text = "London", Color = "#868e96" },
        BottomEnd = new() { Text = "T5", OffsetX = -4 },
    },
}

All three renderers (Canvas, Svg, Html) draw each text in its own color and font. Its own font is also used to measure it, so the room kept for it (and the stacking of the bars) follows its size. With StickyBarLabels, texts aligned with an edge stay in view the same way the centered ones do, and still leave the view with their bar. CollapseMatchingEdgeLabels keeps working on End / Start.

Name conflict

The component already has a Texts parameter (BitResourceTimelineTexts) for its own words: its accessible name, loading text and announcements. To keep the two apart, rename it to Strings (BitResourceTimelineStrings), on the component and on BitResourceTimelineParams.

Breaking changes

The component has only shipped in 11.0.0 prereleases, so this breaks prerelease users only:

Before After
TextAbove = "x" Texts = new() { TopCenter = "x" }
TextBelow = "x" Texts = new() { BottomCenter = "x" }
TextStart = "x" Texts = new() { Start = "x" }
TextEnd = "x" Texts = new() { End = "x" }
<BitResourceTimeline Texts="..." /> <BitResourceTimeline Strings="..." />
BitResourceTimelineTexts BitResourceTimelineStrings

These go into BreakingChanges.md and the breaking-change analyzer (BITBC001 / BITBC002). The Boilerplate's Workbench (ExtrasSection) uses the old names and needs updating separately.

主要语言
C#
星标
1.4k
派生
264
平均合并
7 小时 19 分钟
30 天内合并 PR
583

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

bitfoundation/bitplatform 的其他 Issue

查看 bitfoundation/bitplatform 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。