Upgrade yew, fix regressions.
This commit is contained in:
parent
404aff275a
commit
d19f9051c2
11 changed files with 26 additions and 29 deletions
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "bootstrap-rs"
|
name = "bootstrap-rs"
|
||||||
version = "0.2.11"
|
version = "0.2.12"
|
||||||
authors = ["Thomas Gideon <cmdln@thecommandline.net>"]
|
authors = ["Thomas Gideon <cmdln@thecommandline.net>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ edition = "2018"
|
||||||
crate-type = ["cdylib", "rlib"]
|
crate-type = ["cdylib", "rlib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
yew = "~0.16.2"
|
yew = "~0.17.2"
|
||||||
log = "~0.4.8"
|
log = "~0.4.8"
|
||||||
serde_json = "^1.0.40"
|
serde_json = "^1.0.40"
|
||||||
serde = "^1.0.98"
|
serde = "^1.0.98"
|
||||||
|
@ -16,5 +16,5 @@ anyhow = "^1.0.28"
|
||||||
wasm-bindgen = "~0.2.61"
|
wasm-bindgen = "~0.2.61"
|
||||||
web-sys = "~0.3.38"
|
web-sys = "~0.3.38"
|
||||||
wasm-logger = "~0.2.0"
|
wasm-logger = "~0.2.0"
|
||||||
yew-router = "~0.13.0"
|
yew-router = "~0.14.0"
|
||||||
yew-components = "~0.1.2"
|
yew-components = "~0.2.0"
|
||||||
|
|
|
@ -29,7 +29,7 @@ impl Component for Alert {
|
||||||
fn view(&self) -> Html {
|
fn view(&self) -> Html {
|
||||||
let html = html! {
|
let html = html! {
|
||||||
<div>
|
<div>
|
||||||
{ self.props.children.render() }
|
{ self.props.children.clone() }
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="close"
|
class="close"
|
||||||
|
|
|
@ -58,7 +58,7 @@ impl Component for BreadcrumbItem {
|
||||||
vec!["breadcrumb-item", "active"],
|
vec!["breadcrumb-item", "active"],
|
||||||
html! {
|
html! {
|
||||||
<li class=self.classes() aria-current="page">
|
<li class=self.classes() aria-current="page">
|
||||||
{ self.props.children.render() }
|
{ self.props.children.clone() }
|
||||||
</li>
|
</li>
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -67,7 +67,7 @@ impl Component for BreadcrumbItem {
|
||||||
vec!["breadcrumb-item"],
|
vec!["breadcrumb-item"],
|
||||||
html! {
|
html! {
|
||||||
<li class=self.classes()>
|
<li class=self.classes()>
|
||||||
{ self.props.children.render() }
|
{ self.props.children.clone() }
|
||||||
</li>
|
</li>
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -131,7 +131,6 @@ mod tests {
|
||||||
aria-current="page"
|
aria-current="page"
|
||||||
id="test"
|
id="test"
|
||||||
>
|
>
|
||||||
<></>
|
|
||||||
</li>
|
</li>
|
||||||
};
|
};
|
||||||
assert_eq!(expected, item.view());
|
assert_eq!(expected, item.view());
|
||||||
|
|
|
@ -28,7 +28,7 @@ impl Component for Breadcrumb {
|
||||||
let html = html! {
|
let html = html! {
|
||||||
<nav aria-label="breadcrumb">
|
<nav aria-label="breadcrumb">
|
||||||
<ol class="breadcrumb">
|
<ol class="breadcrumb">
|
||||||
{ self.props.children.render() }
|
{ self.props.children.clone() }
|
||||||
</ol>
|
</ol>
|
||||||
</nav>
|
</nav>
|
||||||
};
|
};
|
||||||
|
|
|
@ -61,7 +61,7 @@ impl Component for Button {
|
||||||
onclick=self.link.callback(|_| ())
|
onclick=self.link.callback(|_| ())
|
||||||
disabled=self.props.disabled.unwrap_or_default()
|
disabled=self.props.disabled.unwrap_or_default()
|
||||||
>
|
>
|
||||||
{ self.props.children.render() }
|
{ self.props.children.clone() }
|
||||||
</button>
|
</button>
|
||||||
};
|
};
|
||||||
render::render_with_prefix(&self.props, self.calculate_prefix(), html)
|
render::render_with_prefix(&self.props, self.calculate_prefix(), html)
|
||||||
|
|
|
@ -41,7 +41,6 @@ mod test {
|
||||||
|
|
||||||
let expected = html! {
|
let expected = html! {
|
||||||
<div class="card-body" style="display: none;">
|
<div class="card-body" style="display: none;">
|
||||||
<></>
|
|
||||||
</div>
|
</div>
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,6 @@ mod test {
|
||||||
|
|
||||||
let expected = html! {
|
let expected = html! {
|
||||||
<p class="card-header">
|
<p class="card-header">
|
||||||
<></>
|
|
||||||
</p>
|
</p>
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,6 @@ mod tests {
|
||||||
};
|
};
|
||||||
let expected = html! {
|
let expected = html! {
|
||||||
<div class="container m-3 pt-3">
|
<div class="container m-3 pt-3">
|
||||||
<></>
|
|
||||||
</div>
|
</div>
|
||||||
};
|
};
|
||||||
assert_eq!(expected, container.view());
|
assert_eq!(expected, container.view());
|
||||||
|
|
|
@ -56,18 +56,19 @@ fn extract_state(props: &Props) -> String {
|
||||||
if props.children.is_empty() {
|
if props.children.is_empty() {
|
||||||
props.value.clone()
|
props.value.clone()
|
||||||
} else {
|
} else {
|
||||||
let node = props.children.render();
|
props.children.iter().fold(String::new(), |mut buf, node| {
|
||||||
if let VNode::VText(text) = node {
|
if let VNode::VText(text) = node {
|
||||||
text.text
|
buf.push_str(&text.text);
|
||||||
} else if let VNode::VList(list) = node {
|
} else if let VNode::VList(list) = node {
|
||||||
list.iter().fold(String::new(), |mut buf, node| {
|
let text = list.iter().fold(String::new(), |mut buf, node| {
|
||||||
if let VNode::VText(text) = node {
|
if let VNode::VText(text) = node {
|
||||||
buf.push_str(&text.text)
|
buf.push_str(&text.text)
|
||||||
}
|
}
|
||||||
buf
|
buf
|
||||||
})
|
});
|
||||||
} else {
|
buf.push_str(&text);
|
||||||
props.value.clone()
|
}
|
||||||
}
|
buf
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ impl Component for Jumbotron {
|
||||||
fn view(&self) -> Html {
|
fn view(&self) -> Html {
|
||||||
let html = html! {
|
let html = html! {
|
||||||
<div>
|
<div>
|
||||||
{ self.props.children.render() }
|
{ self.props.children.clone() }
|
||||||
</div>
|
</div>
|
||||||
};
|
};
|
||||||
render::render_with_prefix(&self.props, "jumbotron", html)
|
render::render_with_prefix(&self.props, "jumbotron", html)
|
||||||
|
|
|
@ -20,7 +20,7 @@ pub(crate) fn render_with_prefix<'a, B: Into<BootstrapProps<'a>>, C: Into<Classe
|
||||||
pub(crate) fn div(children: &Children) -> Html {
|
pub(crate) fn div(children: &Children) -> Html {
|
||||||
html! {
|
html! {
|
||||||
<div>
|
<div>
|
||||||
{ children.render() }
|
{ for children.iter() }
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ pub(crate) fn div(children: &Children) -> Html {
|
||||||
pub(crate) fn p(children: &Children) -> Html {
|
pub(crate) fn p(children: &Children) -> Html {
|
||||||
html! {
|
html! {
|
||||||
<p>
|
<p>
|
||||||
{ children.render() }
|
{ for children.iter() }
|
||||||
</p>
|
</p>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue