Refactor: results expose Element as a named field

Every component result type now names its element Element instead of
embedding *ui.Element. The eleven element-plus-changed results
(AccordionView, CarouselView, CollapsibleView, ImageViewerView,
PaginationResult, StepsResult, SidebarResult, TabsResult, RatingParts,
FileDropZoneParts, TransferParts) fold into ChoiceResult.

Fixes four Gallery demos where .Width(...).Changed() read the element's
flag instead of the component's: Accordion, MultiSelect, Cascader,
TreeSelect. TestDataAccordionDemoLogsChange covers the Accordion.
This commit is contained in:
ZacharyZhang-NY committed 2026-10-05 13:35:53 -04:00
1 parent 078dcab8b4
commit 8880865021
73 files changed
+163 -245

No files matched your search

+2 -2
View File
@@ -85,7 +85,7 @@ func (s *DataTableState[K]) Rows() int { return len(s.cache.view) }
// DataTableView is a built DataTable and what happened to it in this frame.
type DataTableView struct {
*ui.Element
Element *ui.Element
changed, submitted, sorted, retry bool
}
@@ -114,7 +114,7 @@ func DataTable[R any, K comparable](c *ui.Context, s *DataTableState[K], rows []
before := s.Sort
var v DataTableView
v.Element = ui.Column(c).MinHeight(0).Gap(d.Unit() * 2)
v.Children(func() {
v.Element.Children(func() {
if len(rows) > 0 {
ui.Row(c).Justify(ui.End).Children(func() {
tableColumnMenu(c, dataTableMenu(opts), &s.Sort, &s.Layout, &s.Hidden)