Skip to content

feat(table): v2 table bubble #772

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: v2-exp
Choose a base branch
from
636 changes: 416 additions & 220 deletions table/table.go

Large diffs are not rendered by default.

499 changes: 396 additions & 103 deletions table/table_test.go

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions table/testdata/TestNewFromTemplate.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
┌────────────┬────────────┬───────────┬───────────┬────────────┬───────────────┐
│ #  │ Name  │ Type 1  │ Type 2  │ Japanese  │ Official Rom. │
├────────────┼────────────┼───────────┼───────────┼────────────┼───────────────┤
│ 1  │ Bulbasaur  │ Grass  │ Poison  │ フシギダネ │ Fushigidane  │
│ 2  │ Ivysaur  │ Grass  │ Poison  │ フシギソウ │ Fushigisou  │
│ 3  │ Venusaur  │ Grass  │ Poison  │ フシギバナ │ Fushigibana  │
│ 4  │ Charmander │ Fire  │   │ ヒトカゲ  │ Hitokage  │
│ 5  │ Charmeleon │ Fire  │   │ リザード  │ Lizardo  │
│ 6  │ Charizard  │ Fire  │ Flying  │ リザードン │ Lizardon  │
│ 7  │ Squirtle  │ Water  │   │ ゼニガメ  │ Zenigame  │
│ 8  │ Wartortle  │ Water  │   │ カメール  │ Kameil  │
│ 9  │ Blastoise  │ Water  │   │ カメックス │ Kamex  │
│ 10  │ Caterpie  │ Bug  │   │ キャタピー │ Caterpie  │
│ 11  │ Metapod  │ Bug  │   │ トランセル │ Trancell  │
│ 12  │ Butterfree │ Bug  │ Flying  │ バタフリー │ Butterfree  │
│ 13  │ Weedle  │ Bug  │ Poison  │ ビードル  │ Beedle  │
│ 14  │ Kakuna  │ Bug  │ Poison  │ コクーン  │ Cocoon  │
│ 15  │ Beedrill  │ Bug  │ Poison  │ スピアー  │ Spear  │
│ 16  │ Pidgey  │ Normal  │ Flying  │ ポッポ  │ Poppo  │
│ 17  │ Pidgeotto  │ Normal  │ Flying  │ ピジョン  │ Pigeon  │
│ 18  │ Pidgeot  │ Normal  │ Flying  │ ピジョット │ Pigeot  │
│ 19  │ Rattata  │ Normal  │   │ コラッタ  │ Koratta  │
│ 20  │ Raticate  │ Normal  │   │ ラッタ  │ Ratta  │
│ 21  │ Spearow  │ Normal  │ Flying  │ オニスズメ │ Onisuzume  │
│ 22  │ Fearow  │ Normal  │ Flying  │ オニドリル │ Onidrill  │
│ 23  │ Ekans  │ Poison  │   │ アーボ  │ Arbo  │
│ 24  │ Arbok  │ Poison  │   │ アーボック │ Arbok  │
│ 25  │ Pikachu  │ Electric  │   │ ピカチュウ │ Pikachu  │
│ 26  │ Raichu  │ Electric  │   │ ライチュウ │ Raichu  │
│ 27  │ Sandshrew  │ Ground  │   │ サンド  │ Sand  │
│ 28  │ Sandslash  │ Ground  │   │ サンドパン │ Sandpan  │
└────────────┴────────────┴───────────┴───────────┴────────────┴───────────────┘
10 changes: 10 additions & 0 deletions table/testdata/TestOverwriteStyles/clear_styles.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
┌────────────────────────────────────┐
│RankCity Country Population│
├────────────────────────────────────┤
│1 Tokyo Japan 37,274,000│
│2 Delhi India 32,065,760│
│3 Shanghai China 28,516,904│
│4 Dhaka Bangladesh22,478,116│
│5 São Paulo Brazil 22,429,800│
│… … … … │
└────────────────────────────────────┘
10 changes: 10 additions & 0 deletions table/testdata/TestOverwriteStyles/new_styles.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
┌────────────────────────────────────────────┐
│ Rank  City   Country   Population │
├────────────────────────────────────────────┤
│ 1   Tokyo   Japan   37,274,000 │
│ 2   Delhi   India   32,065,760 │
│ 3   Shanghai   China   28,516,904 │
│ 4   Dhaka   Bangladesh  22,478,116 │
│ 5   São Paulo   Brazil   22,429,800 │
│ …   …   …   …  │
└────────────────────────────────────────────┘
20 changes: 20 additions & 0 deletions table/testdata/TestOverwriteStylesFromLipgloss.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
┌───────────────────┬───────────────────┬───────────────────┬──────────────────┐
│ Rank  │ City  │ Country  │ Population  │
├───────────────────┼───────────────────┼───────────────────┼──────────────────┤
│ 1  │ Tokyo  │ Japan  │ 37,274,000  │
│ 2  │ Delhi  │ India  │ 32,065,760  │
│ 3  │ Shanghai  │ China  │ 28,516,904  │
│ 4  │ Dhaka  │ Bangladesh  │ 22,478,116  │
│ 5  │ São Paulo  │ Brazil  │ 22,429,800  │
│ 6  │ Mexico City  │ Mexico  │ 22,085,140  │
│ 7  │ Cairo  │ Egypt  │ 21,750,020  │
│ 8  │ Beijing  │ China  │ 21,333,332  │
│ 9  │ Mumbai  │ India  │ 20,961,472  │
│ 10  │ Osaka  │ Japan  │ 19,059,856  │
│ 11  │ Chongqing  │ China  │ 16,874,740  │
│ 12  │ Karachi  │ Pakistan  │ 16,839,950  │
│ 13  │ Istanbul  │ Turkey  │ 15,636,243  │
│ 14  │ Kinshasa  │ DR Congo  │ 15,628,085  │
│ 15  │ Lagos  │ Nigeria  │ 15,387,639  │
│ 16  │ Buenos Aires  │ Argentina  │ 15,369,919  │
└───────────────────┴───────────────────┴───────────────────┴──────────────────┘
10 changes: 10 additions & 0 deletions table/testdata/TestSetBorder/invalid_number_of_arguments.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
┌────────────────────────────────────────────┐
│ Rank  City   Country   Population │
├────────────────────────────────────────────┤
│ 1   Tokyo   Japan   37,274,000 │
│ 2   Delhi   India   32,065,760 │
│ 3   Shanghai   China   28,516,904 │
│ 4   Dhaka   Bangladesh  22,478,116 │
│ 5   São Paulo   Brazil   22,429,800 │
│ …   …   …   …  │
└────────────────────────────────────────────┘
10 changes: 10 additions & 0 deletions table/testdata/TestSetBorder/no_left_border.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
────────────────────────────────────────────┐
 Rank  City   Country   Population │
────────────────────────────────────────────┤
 1   Tokyo   Japan   37,274,000 │
 2   Delhi   India   32,065,760 │
 3   Shanghai   China   28,516,904 │
 4   Dhaka   Bangladesh  22,478,116 │
 5   São Paulo   Brazil   22,429,800 │
 …   …   …   …  │
────────────────────────────────────────────┘
10 changes: 10 additions & 0 deletions table/testdata/TestSetBorder/no_top_border.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
│ Rank  City   Country   Population │
├────────────────────────────────────────────┤
│ 1   Tokyo   Japan   37,274,000 │
│ 2   Delhi   India   32,065,760 │
│ 3   Shanghai   China   28,516,904 │
│ 4   Dhaka   Bangladesh  22,478,116 │
│ 5   São Paulo   Brazil   22,429,800 │
│ 6   Mexico City   Mexico   22,085,140 │
│ …   …   …   …  │
└────────────────────────────────────────────┘
Loading
Loading