update
This commit is contained in:
parent
5c5dd071cb
commit
78b4b34830
@ -25,7 +25,7 @@ extern "C" {
|
||||
#[derive(Store, Clone)]
|
||||
struct AppStore {
|
||||
root: Filter,
|
||||
selected_filter: Option<Field<Filter>>,
|
||||
selected_filter: Option<Vec<Field<Filter>>>,
|
||||
}
|
||||
|
||||
#[component]
|
||||
@ -48,7 +48,7 @@ fn Main() -> impl IntoView {
|
||||
let selected = store.selected_filter().get();
|
||||
match selected {
|
||||
Some(selected) => {
|
||||
if selected.id().get() == store.root().id().get() {
|
||||
if selected[0].id().get() == store.root().id().get() {
|
||||
FilterRoot().into_any()
|
||||
} else {
|
||||
view! { <FilterDetail filter=selected /> }.into_any()
|
||||
@ -73,7 +73,7 @@ fn Main() -> impl IntoView {
|
||||
log!("action");
|
||||
if let components::filter::Action::Select(f) = action {
|
||||
log!("select");
|
||||
store.selected_filter().set(Some(f));
|
||||
store.selected_filter().set(Some(vec![f]));
|
||||
}
|
||||
}
|
||||
root=true
|
||||
|
||||
@ -11,7 +11,7 @@ fn group(
|
||||
filter: Field<Filter>,
|
||||
group: Field<FilterGroup>,
|
||||
on_action: Callback<(Action,)>,
|
||||
selected: Field<Option<Field<Filter>>>,
|
||||
selected: Field<Option<Vec<Field<Filter>>>>,
|
||||
root: bool,
|
||||
) -> impl IntoView {
|
||||
let header = move || {
|
||||
@ -51,7 +51,7 @@ fn group(
|
||||
}
|
||||
};
|
||||
let active = move || match selected.get() {
|
||||
Some(f) => filter.id().get() == f.id().get(),
|
||||
Some(f) => filter.id().get() == f[0].id().get(),
|
||||
None => false,
|
||||
};
|
||||
view! {
|
||||
@ -144,7 +144,7 @@ fn leaf(
|
||||
filter: Field<Filter>,
|
||||
leaf: Field<FilterLeaf>,
|
||||
on_action: Callback<(Action,)>,
|
||||
selected: Field<Option<Field<Filter>>>,
|
||||
selected: Field<Option<Vec<Field<Filter>>>>,
|
||||
) -> impl IntoView {
|
||||
let header = move || filter.id().get().to_string();
|
||||
|
||||
@ -156,7 +156,7 @@ fn leaf(
|
||||
}
|
||||
};
|
||||
let active = move || match selected.get() {
|
||||
Some(f) => filter.id().get() == f.id().get(),
|
||||
Some(f) => filter.id().get() == f[0].id().get(),
|
||||
None => false,
|
||||
};
|
||||
view! {
|
||||
@ -211,7 +211,7 @@ pub enum Action {
|
||||
pub fn Filter(
|
||||
#[prop(into)] filter: Field<Filter>,
|
||||
#[prop(into)] on_action: Callback<(Action,)>,
|
||||
#[prop(into)] selected: Field<Option<Field<Filter>>>,
|
||||
#[prop(into)] selected: Field<Option<Vec<Field<Filter>>>>,
|
||||
#[prop(optional)] root: bool,
|
||||
) -> impl IntoView {
|
||||
let remain = filter.remain();
|
||||
|
||||
@ -3,7 +3,7 @@ use reactive_stores::Field;
|
||||
use src_common::models::loot_filter::Filter;
|
||||
|
||||
#[component]
|
||||
pub fn FilterDetail(#[prop(into)] filter: Field<Filter>) -> impl IntoView {
|
||||
pub fn FilterDetail(#[prop(into)] filter: Vec<Field<Filter>>) -> impl IntoView {
|
||||
view! {
|
||||
<article class="prose">
|
||||
<h3>Filter details:</h3>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user