[New Component] TreeView

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

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

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
8/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
csharp
Lĩnh vực
accessibility, frontend

Hướng nghiên cứu

This is a new component, not a fix, and the payload has no existing code to start from. Read the related issue #1065 and the draft API, then look at how existing components are laid out under blazorbootstrap/Components/. Done would require a first slice of the v1 list (for example basic data binding and expand/collapse) with XML docs and a demo page, agreed with the maintainers before coding.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

area-tree-view new component

Summary

Add a data-bound TreeView<TItem> component for hierarchical data with lazy loading, selection (including tri-state checkboxes), search, and full keyboard support.

Motivation

TreeView is requested across the Blazor UI ecosystem and in this repository as a hierarchical list (#1065). Common uses: folder browsers, category pickers, organization charts, and permission editors.

Proposed API (draft)

<TreeView TItem="Folder"
          Data="rootFolders"
          TextField="f => f.Name"
          ChildrenSelector="f => f.SubFolders"
          HasChildrenSelector="f => f.HasSubFolders"
          ChildrenProvider="LoadChildrenAsync"
          SelectionMode="TreeViewSelectionMode.Checkbox"
          @bind-SelectedItems="selectedFolders"
          @bind-ExpandedItems="expandedFolders">
    <ItemTemplate Context="folder">
        <Icon Name="IconName.Folder" /> @folder.Name
    </ItemTemplate>
</TreeView>

Must-have features (v1)

  • Data binding: Data, TextField, ChildrenSelector, HasChildrenSelector, ItemTemplate, IconSelector.
  • Lazy loading: ChildrenProvider (async) with per-node loading indicator.
  • Expand/collapse: @bind-ExpandedItems, ExpandAllAsync, CollapseAllAsync, OnExpandedChanged.
  • Selection: SelectionMode (TreeViewSelectionMode: None, Single, Multiple, Checkbox) with @bind-SelectedItem / @bind-SelectedItems.
  • Checkbox mode: tri-state parents (checked / unchecked / indeterminate) with up and down propagation; option to disable cascading.
  • Disabled nodes (DisabledSelector); OnNodeClick event.
  • Search/filter (FilterText or built-in search box) that auto-expands branches containing matches and highlights them.
  • UI updates when the bound collections change (add, remove, rename nodes).

Accessibility

  • WAI-ARIA tree pattern: role="tree", treeitem, group, aria-expanded, aria-selected / aria-checked, aria-level.
  • Keyboard: Up/Down, Right (expand / first child), Left (collapse / parent), Home/End, Enter/Space, type-ahead, * expands siblings.
  • Roving tabindex (only one node in tab order).

Out of scope (later)

  • Drag-and-drop to move or reparent nodes.
  • Tree select inside a dropdown.
  • Virtualization for very large trees.

Acceptance criteria

  • Component in blazorbootstrap/Components/TreeView/.
  • XML docs on all public parameters, methods, and events.
  • Demo page covering: basic, icons, templates, lazy loading, single, multiple, checkbox tri-state, disabled nodes, expand/collapse all, search, dynamic updates, keyboard navigation.
  • Verified in Server and WebAssembly demo hosts.
  • Docs page docs/docs/05-components/tree-view.mdx.
  • Builds for .NET 8, 9, 10.

Related

#1065

Ngôn ngữ chính
HTML
Star
1.2k
Fork
111
Merge trung bình
4 phút
Pull request đã merge (30 ngày)
55

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 vikramlearning/blazorbootstrap

Tất cả issue của vikramlearning/blazorbootstrap

Issue tương tự

Thêm issue về Accessibility

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.