mirror of
https://seed.radicle.dev/rad:z39mP9rQAaGmERfUMPULfPUi473tY.git
synced 2026-11-29 06:20:28 +08:00
lib: Improve boxed property conversion
This commit is contained in:
+2
-2
@@ -193,7 +193,7 @@ where
|
||||
use ratatui::widgets::Table;
|
||||
|
||||
let props = props
|
||||
.and_then(|props| ShortcutsProps::from_boxed_any(props))
|
||||
.and_then(ShortcutsProps::from_boxed_any)
|
||||
.unwrap_or(self.props.clone());
|
||||
|
||||
let mut shortcuts = props.shortcuts.iter().peekable();
|
||||
@@ -471,7 +471,7 @@ where
|
||||
{
|
||||
fn render(&self, frame: &mut ratatui::Frame, area: Rect, props: Option<Box<dyn Any>>) {
|
||||
let props = props
|
||||
.and_then(|props| TableProps::<'_, R>::from_boxed_any(props))
|
||||
.and_then(TableProps::<'_, R>::from_boxed_any)
|
||||
.unwrap_or(self.props.clone());
|
||||
|
||||
let widths: Vec<Constraint> = self
|
||||
|
||||
@@ -121,7 +121,7 @@ where
|
||||
{
|
||||
fn render(&self, frame: &mut ratatui::Frame, area: Rect, props: Option<Box<dyn Any>>) {
|
||||
let props = props
|
||||
.and_then(|props| HeaderProps::from_boxed_any(props))
|
||||
.and_then(HeaderProps::from_boxed_any)
|
||||
.unwrap_or(self.props.clone());
|
||||
|
||||
let widths: Vec<Constraint> = props
|
||||
@@ -309,7 +309,7 @@ where
|
||||
{
|
||||
fn render(&self, frame: &mut ratatui::Frame, area: Rect, props: Option<Box<dyn Any>>) {
|
||||
let props = props
|
||||
.and_then(|props| FooterProps::from_boxed_any(props))
|
||||
.and_then(FooterProps::from_boxed_any)
|
||||
.unwrap_or(self.props.clone());
|
||||
|
||||
let widths = props
|
||||
@@ -465,7 +465,7 @@ where
|
||||
{
|
||||
fn render(&self, frame: &mut ratatui::Frame, area: Rect, props: Option<Box<dyn Any>>) {
|
||||
let props = props
|
||||
.and_then(|props| ContainerProps::from_boxed_any(props))
|
||||
.and_then(ContainerProps::from_boxed_any)
|
||||
.unwrap_or(self.props.clone());
|
||||
|
||||
let header_h = if self.header.is_some() { 3 } else { 0 };
|
||||
|
||||
@@ -200,7 +200,7 @@ where
|
||||
{
|
||||
fn render(&self, frame: &mut ratatui::Frame, area: Rect, props: Option<Box<dyn Any>>) {
|
||||
let props = props
|
||||
.and_then(|props| TextFieldProps::from_boxed_any(props))
|
||||
.and_then(TextFieldProps::from_boxed_any)
|
||||
.unwrap_or(self.props.clone());
|
||||
|
||||
let layout = Layout::vertical(Constraint::from_lengths([1, 1])).split(area);
|
||||
|
||||
@@ -218,7 +218,7 @@ where
|
||||
{
|
||||
fn render(&self, frame: &mut ratatui::Frame, area: Rect, props: Option<Box<dyn Any>>) {
|
||||
let props = props
|
||||
.and_then(|props| ParagraphProps::from_boxed_any(props))
|
||||
.and_then(ParagraphProps::from_boxed_any)
|
||||
.unwrap_or(self.props.clone());
|
||||
|
||||
let [content_area] = Layout::horizontal([Constraint::Min(1)])
|
||||
|
||||
Reference in New Issue
Block a user