use crate::EventHandler;
use crate::table_row::TableRow;
use leptos::prelude::*;
#[allow(unused_variables)]
pub fn DefaultTableRowRenderer<Row, Column>(
class: Signal<String>,
row: RwSignal<Row>,
index: usize,
selected: Signal<bool>,
on_select: EventHandler<web_sys::MouseEvent>,
columns: RwSignal<Vec<Column>>,
) -> impl IntoView
where
Row: TableRow<Column> + 'static,
Column: Copy + Send + Sync + 'static,
{
view! {
<tr class=class on:click=move |mouse_event| on_select.run(mouse_event)>
{TableRow::render_row(row, index, columns)}
</tr>
}
}
pub fn DefaultRowPlaceholderRenderer(height: Signal<f64>) -> impl IntoView {
view! { <tr style:height=move || format!("{}px", height.get()) style="display: block"></tr> }
}
#[allow(unused_variables)]
pub fn DefaultErrorRowRenderer(err: String, index: usize, col_count: usize) -> impl IntoView {
view! { <tr><td colspan=col_count>{err}</td></tr> }
}
#[allow(unused_variables, unstable_name_collisions)]
pub fn DefaultLoadingRowRenderer(
class: Signal<String>,
get_cell_class: Callback<(usize,), String>,
get_inner_cell_class: Callback<(usize,), String>,
index: usize,
col_count: usize,
) -> impl IntoView {
view! {
<tr class=class>
{
(0..col_count).map(|col_index| view! {
<td class=get_cell_class.run((col_index,))>
<div class=get_inner_cell_class.run((col_index,))></div>
" "
</td>
}).collect_view()
}
</tr>
}
}