leptos_struct_table/components/
cell.rs

1#![allow(unused_variables)]
2
3use crate::CellValue;
4use std::marker::PhantomData;
5
6use leptos::prelude::*;
7
8/// The default cell renderer. Uses the `<td>` element.
9#[component]
10pub fn DefaultTableCellRenderer<Row, T, M>(
11    /// The class attribute for the cell element. Generated by the classes provider.
12    class: String,
13    /// The value to display.
14    value: Signal<T>,
15    /// Event handler called when the cell is changed. In this default renderer this will never happen.
16    row: RwSignal<Row>,
17    /// The index of the column. Starts at 0.
18    index: usize,
19    options: T::RenderOptions,
20    #[prop(optional)] _marker: PhantomData<M>,
21) -> impl IntoView
22where
23    Row: Send + Sync + 'static,
24    T: CellValue<M> + Send + Sync + Clone + 'static,
25    M: 'static,
26{
27    view! {
28        <td class=class>{move || value.get().render_value(options.clone())}</td>
29    }
30}