refactor(office): generalize DataTable layout and document TUI table skill
Unify project/user flex column layout into layoutFlexTable with per-subject policy in model. Add office-tui-table skill and AGENTS notes; fix CI go mod tidy drift and test matrix Go version to match go.mod 1.25. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package model
|
||||
|
||||
// TableFlexLayout describes a list table where every column stays visible and
|
||||
// one flex column absorbs leftover pane width.
|
||||
type TableFlexLayout struct {
|
||||
FlexColumnKey string
|
||||
MinFlexWidth int
|
||||
}
|
||||
|
||||
// TableFlexLayoutFor returns a flex layout policy for subjects that show all columns.
|
||||
func TableFlexLayoutFor(subject Subject) (TableFlexLayout, bool) {
|
||||
switch subject {
|
||||
case SubjectProjects:
|
||||
return TableFlexLayout{FlexColumnKey: "title", MinFlexWidth: 12}, true
|
||||
case SubjectUsers:
|
||||
return TableFlexLayout{FlexColumnKey: "email", MinFlexWidth: 16}, true
|
||||
default:
|
||||
return TableFlexLayout{}, false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package model
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestTableFlexLayoutFor(t *testing.T) {
|
||||
proj, ok := TableFlexLayoutFor(SubjectProjects)
|
||||
if !ok || proj.FlexColumnKey != "title" || proj.MinFlexWidth != 12 {
|
||||
t.Fatalf("projects layout=%+v ok=%v", proj, ok)
|
||||
}
|
||||
users, ok := TableFlexLayoutFor(SubjectUsers)
|
||||
if !ok || users.FlexColumnKey != "email" {
|
||||
t.Fatalf("users layout=%+v", users)
|
||||
}
|
||||
_, ok = TableFlexLayoutFor(SubjectTasks)
|
||||
if ok {
|
||||
t.Fatal("tasks should use scrolling layout")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user