|
|
|
@ -13,7 +13,7 @@ use crate::{
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Prop)]
|
|
|
|
#[derive(Prop)]
|
|
|
|
pub struct PaginatedTableStateRx<M, F, C>
|
|
|
|
pub struct PaginatedTableStateRx<'a, M, F, C>
|
|
|
|
where
|
|
|
|
where
|
|
|
|
M: 'static,
|
|
|
|
M: 'static,
|
|
|
|
C: Fn(Option<String>, i64, i64) -> F,
|
|
|
|
C: Fn(Option<String>, i64, i64) -> F,
|
|
|
|
@ -22,9 +22,10 @@ where
|
|
|
|
pub record_label: String,
|
|
|
|
pub record_label: String,
|
|
|
|
pub route: C,
|
|
|
|
pub route: C,
|
|
|
|
pub filter: Option<String>,
|
|
|
|
pub filter: Option<String>,
|
|
|
|
|
|
|
|
pub table_class: &'a String,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl<M, F, C> PaginatedTableStateRx<M, F, C>
|
|
|
|
impl<'a, M, F, C> PaginatedTableStateRx<'a, M, F, C>
|
|
|
|
where
|
|
|
|
where
|
|
|
|
M: 'static,
|
|
|
|
M: 'static,
|
|
|
|
C: Fn(Option<String>, i64, i64) -> F,
|
|
|
|
C: Fn(Option<String>, i64, i64) -> F,
|
|
|
|
@ -39,7 +40,7 @@ where
|
|
|
|
#[component]
|
|
|
|
#[component]
|
|
|
|
pub fn PaginatedTable<'a, G, M, F, C>(
|
|
|
|
pub fn PaginatedTable<'a, G, M, F, C>(
|
|
|
|
cx: Scope<'a>,
|
|
|
|
cx: Scope<'a>,
|
|
|
|
props: PaginatedTableStateRx<M, F, C>,
|
|
|
|
props: PaginatedTableStateRx<'a, M, F, C>,
|
|
|
|
) -> View<G>
|
|
|
|
) -> View<G>
|
|
|
|
where
|
|
|
|
where
|
|
|
|
G: Html,
|
|
|
|
G: Html,
|
|
|
|
@ -53,6 +54,7 @@ where
|
|
|
|
let table_prop: TableContentRx<G> = TableContentRx {
|
|
|
|
let table_prop: TableContentRx<G> = TableContentRx {
|
|
|
|
headers_view: create_signal(cx, vec![]),
|
|
|
|
headers_view: create_signal(cx, vec![]),
|
|
|
|
data_view: create_signal(cx, vec![vec![]]),
|
|
|
|
data_view: create_signal(cx, vec![vec![]]),
|
|
|
|
|
|
|
|
table_class: props.table_class,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
let page = create_signal(cx, 0);
|
|
|
|
let page = create_signal(cx, 0);
|
|
|
|
let n_page = create_signal(cx, 1);
|
|
|
|
let n_page = create_signal(cx, 1);
|
|
|
|
@ -132,7 +134,7 @@ where
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
BaseTable(headers_view=table_prop.headers_view, data_view=table_prop.data_view)
|
|
|
|
BaseTable(headers_view=table_prop.headers_view, data_view=table_prop.data_view, table_class=table_prop.table_class)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|