bubbles icon indicating copy to clipboard operation
bubbles copied to clipboard

feat(table): v2 table bubble

Open bashbunni opened this issue 7 months ago • 2 comments

uses Lip Gloss table to render the table. Also allows users to create bubbles tables from existing Lip Gloss tables.

  • Depends on https://github.com/charmbracelet/lipgloss/pull/512
  • Depends on https://github.com/charmbracelet/lipgloss/pull/526
  • Runnable example: https://github.com/charmbracelet/bubbletea/pull/1380

image


Bash notes

github.com/charmbracelet/bubbles/table

incompatible changes

removed: FromValues -> seems unnecessary

Allow chaining setters

New -> changed from func(...Option) Model to func(...Option) *Model (*Model).SetCursor: changed from func(int) to func(int) *Model (*Model).SetHeight: changed from func(int) to func(int) *Model (*Model).SetRows: changed from func([]Row) to func(...[]string) *Model (*Model).SetStyles: changed from func(Styles) to func(Styles) *Model (*Model).SetWidth: changed from func(int) to func(int) *Model

Height and Width calculations now delegated to Lip Gloss

removed: Model.Width removed: Model.Height

Removed wrapper types Column and Row

Row

removed: Row -> using [][]string instead refactor: WithRows -> changed from func([]Row) Option to func(...[]string) Option refactor: Model.Rows -> changed from func() []Row to func() [][]string refactor: Model.SelectedRow -> changed from func() Row to func() []string

Columns, now headers

refactor: WithColumns() -> WithHeaders() refactor: Model.Columns -> Model.Headers refactor: (*Model).SetColumns -> (*Model).SetHeaders removed: Column

Removed viewport

removed: (*Model).UpdateViewport

compatible changes

Support Lip Gloss Border customizations

(*Model).Border: added (*Model).BorderBottom: added (*Model).BorderColumn: added (*Model).BorderHeader: added (*Model).BorderLeft: added (*Model).BorderRight: added (*Model).BorderRow: added (*Model).BorderStyle: added (*Model).BorderTop: added (*Model).SetBorder: added

Manage styles

(*Model).OverwriteStyles: added (*Model).OverwriteStylesFromLipgloss: added (*Model).SetStyleFunc: added (*Model).SetYOffset: added NewFromTemplate: added WithStyleFunc: added


Andrey's TODO:

  • [x] Make selected row index and offset work independently and correctly
  • [x] Ensure that pageup/pagedown/home/end work correctly

bashbunni avatar Apr 04 '25 05:04 bashbunni