dynamo-browse/internal/dynamo-browse/ui/teamodels/colselector/tblmodel.go
Leon Mika 982d3a9ca7
Issue 18: Added a popup to modify table columns (#31)
Added a new popup to modify the columns of the table. With this new popup, the user can:

- Show and hide columns
- Move columns around
- Add new columns which are derived from the value of an expression
- Delete columns

Also got the overlay mechanisms working.
2022-10-04 22:23:48 +11:00

32 lines
635 B
Go

package colselector
import (
"fmt"
"github.com/charmbracelet/lipgloss"
table "github.com/lmika/go-bubble-table"
"io"
)
type colListRowModel struct {
m *colListModel
}
func (clr colListRowModel) Render(w io.Writer, model table.Model, index int) {
cols := clr.m.colController.Columns()
if cols == nil {
return
}
var style lipgloss.Style
if index == model.Cursor() {
style = model.Styles.SelectedRow
}
col := clr.m.colController.Columns().Columns[index]
if !col.Hidden {
fmt.Fprintln(w, style.Render(fmt.Sprintf(".\t%v", col.Name)))
} else {
fmt.Fprintln(w, style.Render(fmt.Sprintf("✕\t%v", col.Name)))
}
}