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

Đang mở
#15,441 0 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@msynk đang làm issue này rồi.

Từ ngày 22/11/2026.

  • #15442 của @msynk — đang mở

Đánh giá

Issue này chưa được đánh giá.

Mô tả

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.

Ngôn ngữ chính
C#
Star
1.4k
Fork
264
Merge trung bình
8 giờ 5 phút
Pull request đã merge (30 ngày)
595

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của bitfoundation/bitplatform

Tất cả issue của bitfoundation/bitplatform

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.