fix(table): substract headers Y size from the total table size (#434)

* fix(table): substract headers Y size from the total table size

* fix: change GetFrameSize to GetVerticalFrameSize and calc header height

* fix: remove GetVerticalFrameSize at all

* fix: account for headers in height WithHeight, SetHeight

---------

Co-authored-by: Maas Lalani <maas@lalani.dev>
This commit is contained in:
Maciej Więcek
2024-03-13 14:31:42 -04:00
committed by GitHub
co-authored by Maas Lalani
parent 961c081347
commit 6dbfc8284d
+2 -2
View File
@@ -163,7 +163,7 @@ func WithRows(rows []Row) Option {
// WithHeight sets the height of the table.
func WithHeight(h int) Option {
return func(m *Model) {
m.viewport.Height = h
m.viewport.Height = h - lipgloss.Height(m.headersView())
}
}
@@ -314,7 +314,7 @@ func (m *Model) SetWidth(w int) {
// SetHeight sets the height of the viewport of the table.
func (m *Model) SetHeight(h int) {
m.viewport.Height = h
m.viewport.Height = h - lipgloss.Height(m.headersView())
m.UpdateViewport()
}