| 1 | package Term::Fabulous::Widget::Table::Cell; | ||
| 2 | |||
| 3 | use v5.32; | ||
| 4 | use warnings; | ||
| 5 | use feature 'signatures'; | ||
| 6 | no warnings 'experimental::signatures'; | ||
| 7 | |||
| 8 | our $VERSION = '0.05'; | ||
| 9 | |||
| 10 | use Object::Pad 0.825; | ||
| 11 | |||
| 12 | use Clay::UI::Role::Layout::GridCell; | ||
| 13 | use Term::Fabulous::Widget::Box; | ||
| 14 | |||
| 15 | class Term::Fabulous::Widget::Table::Cell | ||
| 16 | :isa(Term::Fabulous::Widget::Box) | ||
| 17 | :does(Clay::UI::Role::Layout::GridCell) | ||
| 18 | :strict(params) | ||
| 19 | { | ||
| 20 | use Term::Fabulous::Check qw(one_of); | ||
| 21 | |||
| 22 | # Which part of the table the cell belongs to ('header', 'filter', | ||
| 23 | # 'body', 'ledge'), the line it shows (a line key of the table's model; | ||
| 24 | # undef outside the body) and its column (a column key, '' for the | ||
| 25 | # selection column, undef for a cell that spans the columns). | ||
| 26 | field $part :param :reader = 'body'; | ||
| 27 | field $line_key :param :reader = undef; | ||
| 28 | field $column_key :param :reader = undef; | ||
| 29 | |||
| 30 | ADJUST { | ||
| 31 | one_of( $self, part => $part, qw(header filter body ledge) ); | ||
| 32 | } | ||
| 33 | } | ||
| 34 | |||
| 35 | 1; | ||
| 36 | |||
| 37 | __END__ |