76 files changed
+4670
-1114
No files matched your search
+2
-5
@@ -26,7 +26,7 @@ fn app(cx: Scope) -> Element {
|
||||
button {
|
||||
onclick: move |_| {
|
||||
let dom = VirtualDom::new_with_props(compose, ComposeProps { app_tx: tx.clone() });
|
||||
window.new_window(dom, Default::default());
|
||||
dioxus_desktop::window().new_window(dom, Default::default());
|
||||
},
|
||||
"Click to compose a new email"
|
||||
}
|
||||
@@ -62,10 +62,7 @@ fn compose(cx: Scope<ComposeProps>) -> Element {
|
||||
"Click to send"
|
||||
}
|
||||
|
||||
input {
|
||||
oninput: move |e| user_input.set(e.value.clone()),
|
||||
value: "{user_input}"
|
||||
}
|
||||
input { oninput: move |e| user_input.set(e.value()), value: "{user_input}" }
|
||||
}
|
||||
})
|
||||
}
|
||||
+1
-1
@@ -22,7 +22,7 @@ fn app(cx: Scope) -> Element {
|
||||
input {
|
||||
value: "{counter}",
|
||||
oninput: move |e| {
|
||||
if let Ok(value) = e.value.parse::<usize>() {
|
||||
if let Ok(value) = e.value().parse::<usize>() {
|
||||
counters.make_mut()[i] = value;
|
||||
}
|
||||
}
|
||||
|
||||
+26
-60
@@ -35,14 +35,16 @@ fn App(cx: Scope) -> Element {
|
||||
rel: "stylesheet",
|
||||
href: "https://unpkg.com/purecss@2.0.6/build/pure-min.css",
|
||||
integrity: "sha384-Uu6IeWbM+gzNVXJcM9XV3SohHtmWE+3VGi496jvgX1jyvDTXfdK+rfZc8C1Aehk5",
|
||||
crossorigin: "anonymous",
|
||||
crossorigin: "anonymous"
|
||||
}
|
||||
|
||||
style { "
|
||||
style {
|
||||
"
|
||||
.red {{
|
||||
background-color: rgb(202, 60, 60) !important;
|
||||
}}
|
||||
" }
|
||||
"
|
||||
}
|
||||
|
||||
h1 { "Dioxus CRM Example" }
|
||||
|
||||
@@ -57,16 +59,8 @@ fn ClientList(cx: Scope) -> Element {
|
||||
cx.render(rsx! {
|
||||
h2 { "List of Clients" }
|
||||
|
||||
Link {
|
||||
to: Route::ClientAdd {},
|
||||
class: "pure-button pure-button-primary",
|
||||
"Add Client"
|
||||
}
|
||||
Link {
|
||||
to: Route::Settings {},
|
||||
class: "pure-button",
|
||||
"Settings"
|
||||
}
|
||||
Link { to: Route::ClientAdd {}, class: "pure-button pure-button-primary", "Add Client" }
|
||||
Link { to: Route::Settings {}, class: "pure-button", "Settings" }
|
||||
|
||||
clients.read().iter().map(|client| rsx! {
|
||||
div {
|
||||
@@ -94,79 +88,55 @@ fn ClientAdd(cx: Scope) -> Element {
|
||||
class: "pure-form pure-form-aligned",
|
||||
onsubmit: move |_| {
|
||||
let mut clients = clients.write();
|
||||
|
||||
clients.push(Client {
|
||||
first_name: first_name.to_string(),
|
||||
last_name: last_name.to_string(),
|
||||
description: description.to_string(),
|
||||
});
|
||||
|
||||
clients
|
||||
.push(Client {
|
||||
first_name: first_name.to_string(),
|
||||
last_name: last_name.to_string(),
|
||||
description: description.to_string(),
|
||||
});
|
||||
dioxus_router::router().push(Route::ClientList {});
|
||||
},
|
||||
|
||||
fieldset {
|
||||
div {
|
||||
class: "pure-control-group",
|
||||
label {
|
||||
"for": "first_name",
|
||||
"First Name"
|
||||
}
|
||||
div { class: "pure-control-group",
|
||||
label { "for": "first_name", "First Name" }
|
||||
input {
|
||||
id: "first_name",
|
||||
"type": "text",
|
||||
placeholder: "First Name…",
|
||||
required: "",
|
||||
value: "{first_name}",
|
||||
oninput: move |e| first_name.set(e.value.clone())
|
||||
oninput: move |e| first_name.set(e.value())
|
||||
}
|
||||
}
|
||||
|
||||
div {
|
||||
class: "pure-control-group",
|
||||
label {
|
||||
"for": "last_name",
|
||||
"Last Name"
|
||||
}
|
||||
div { class: "pure-control-group",
|
||||
label { "for": "last_name", "Last Name" }
|
||||
input {
|
||||
id: "last_name",
|
||||
"type": "text",
|
||||
placeholder: "Last Name…",
|
||||
required: "",
|
||||
value: "{last_name}",
|
||||
oninput: move |e| last_name.set(e.value.clone())
|
||||
oninput: move |e| last_name.set(e.value())
|
||||
}
|
||||
}
|
||||
|
||||
div {
|
||||
class: "pure-control-group",
|
||||
label {
|
||||
"for": "description",
|
||||
"Description"
|
||||
}
|
||||
div { class: "pure-control-group",
|
||||
label { "for": "description", "Description" }
|
||||
textarea {
|
||||
id: "description",
|
||||
placeholder: "Description…",
|
||||
value: "{description}",
|
||||
oninput: move |e| description.set(e.value.clone())
|
||||
oninput: move |e| description.set(e.value())
|
||||
}
|
||||
}
|
||||
|
||||
div {
|
||||
class: "pure-controls",
|
||||
button {
|
||||
"type": "submit",
|
||||
class: "pure-button pure-button-primary",
|
||||
"Save"
|
||||
}
|
||||
Link {
|
||||
to: Route::ClientList {},
|
||||
class: "pure-button pure-button-primary red",
|
||||
"Cancel"
|
||||
}
|
||||
div { class: "pure-controls",
|
||||
button { "type": "submit", class: "pure-button pure-button-primary", "Save" }
|
||||
Link { to: Route::ClientList {}, class: "pure-button pure-button-primary red", "Cancel" }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -187,10 +157,6 @@ fn Settings(cx: Scope) -> Element {
|
||||
"Remove all Clients"
|
||||
}
|
||||
|
||||
Link {
|
||||
to: Route::ClientList {},
|
||||
class: "pure-button",
|
||||
"Go back"
|
||||
}
|
||||
Link { to: Route::ClientList {}, class: "pure-button", "Go back" }
|
||||
})
|
||||
}
|
||||
@@ -16,7 +16,7 @@ fn App(cx: Scope) -> Element {
|
||||
r#type: "checkbox",
|
||||
checked: "{enable_directory_upload}",
|
||||
oninput: move |evt| {
|
||||
enable_directory_upload.set(evt.value.parse().unwrap());
|
||||
enable_directory_upload.set(evt.value().parse().unwrap());
|
||||
},
|
||||
},
|
||||
"Enable directory upload"
|
||||
@@ -30,7 +30,7 @@ fn App(cx: Scope) -> Element {
|
||||
onchange: |evt| {
|
||||
to_owned![files_uploaded];
|
||||
async move {
|
||||
if let Some(file_engine) = &evt.files {
|
||||
if let Some(file_engine) = &evt.files() {
|
||||
let files = file_engine.files();
|
||||
for file_name in files {
|
||||
sleep(std::time::Duration::from_secs(1)).await;
|
||||
|
||||
+2
-2
@@ -14,8 +14,8 @@ fn app(cx: Scope) -> Element {
|
||||
div {
|
||||
h1 { "Form" }
|
||||
form {
|
||||
onsubmit: move |ev| println!("Submitted {:?}", ev.values),
|
||||
oninput: move |ev| println!("Input {:?}", ev.values),
|
||||
onsubmit: move |ev| println!("Submitted {:?}", ev.values()),
|
||||
oninput: move |ev| println!("Input {:?}", ev.values()),
|
||||
input { r#type: "text", name: "username" }
|
||||
input { r#type: "text", name: "full-name" }
|
||||
input { r#type: "password", name: "password" }
|
||||
|
||||
@@ -12,8 +12,8 @@ fn app(cx: Scope) -> Element {
|
||||
let resp = reqwest::Client::new()
|
||||
.post("http://localhost:8080/login")
|
||||
.form(&[
|
||||
("username", &evt.values["username"]),
|
||||
("password", &evt.values["password"]),
|
||||
("username", &evt.values()["username"]),
|
||||
("password", &evt.values()["password"]),
|
||||
])
|
||||
.send()
|
||||
.await;
|
||||
@@ -31,8 +31,7 @@ fn app(cx: Scope) -> Element {
|
||||
|
||||
cx.render(rsx! {
|
||||
h1 { "Login" }
|
||||
form {
|
||||
onsubmit: onsubmit,
|
||||
form { onsubmit: onsubmit,
|
||||
input { r#type: "text", id: "username", name: "username" }
|
||||
label { "Username" }
|
||||
br {}
|
||||
|
||||
@@ -64,7 +64,7 @@ fn DataEditor(cx: Scope, id: usize) -> Element {
|
||||
fn DataView(cx: Scope, id: usize) -> Element {
|
||||
let cool_data = use_shared_state::<CoolData>(cx).unwrap();
|
||||
|
||||
let oninput = |e: FormEvent| cool_data.write().set(*id, e.value.clone());
|
||||
let oninput = |e: FormEvent| cool_data.write().set(*id, e.value());
|
||||
|
||||
let cool_data = cool_data.read();
|
||||
let my_data = &cool_data.view(id).unwrap();
|
||||
|
||||
@@ -17,7 +17,7 @@ fn app(cx: Scope) -> Element {
|
||||
rows: "10",
|
||||
cols: "80",
|
||||
value: "{model}",
|
||||
oninput: move |e| model.set(e.value.clone()),
|
||||
oninput: move |e| model.set(e.value().clone()),
|
||||
}
|
||||
})
|
||||
}
|
||||
+3
-3
@@ -107,7 +107,7 @@ pub fn TodoHeader<'a>(cx: Scope<'a, TodoHeaderProps<'a>>) -> Element {
|
||||
value: "{draft}",
|
||||
autofocus: "true",
|
||||
oninput: move |evt| {
|
||||
draft.set(evt.value.clone());
|
||||
draft.set(evt.value().clone());
|
||||
},
|
||||
onkeydown: move |evt| {
|
||||
if evt.key() == Key::Enter && !draft.is_empty() {
|
||||
@@ -154,7 +154,7 @@ pub fn TodoEntry<'a>(cx: Scope<'a, TodoEntryProps<'a>>) -> Element {
|
||||
id: "cbg-{todo.id}",
|
||||
checked: "{todo.checked}",
|
||||
oninput: move |evt| {
|
||||
cx.props.todos.make_mut()[&cx.props.id].checked = evt.value.parse().unwrap();
|
||||
cx.props.todos.make_mut()[&cx.props.id].checked = evt.value().parse().unwrap();
|
||||
}
|
||||
}
|
||||
label {
|
||||
@@ -175,7 +175,7 @@ pub fn TodoEntry<'a>(cx: Scope<'a, TodoEntryProps<'a>>) -> Element {
|
||||
input {
|
||||
class: "edit",
|
||||
value: "{todo.contents}",
|
||||
oninput: move |evt| cx.props.todos.make_mut()[&cx.props.id].contents = evt.value.clone(),
|
||||
oninput: move |evt| cx.props.todos.make_mut()[&cx.props.id].contents = evt.value(),
|
||||
autofocus: "true",
|
||||
onfocusout: move |_| is_editing.set(false),
|
||||
onkeydown: move |evt| {
|
||||
|
||||
@@ -12,7 +12,7 @@ fn app(cx: Scope) -> Element {
|
||||
r#type: "number",
|
||||
value: "{level}",
|
||||
oninput: |e| {
|
||||
if let Ok(new_zoom) = e.value.parse::<f64>() {
|
||||
if let Ok(new_zoom) = e.value().parse::<f64>() {
|
||||
level.set(new_zoom);
|
||||
dioxus_desktop::window().webview.zoom(new_zoom);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ fn app(cx: Scope) -> Element {
|
||||
input {
|
||||
value: "{contents}",
|
||||
r#type: "text",
|
||||
oninput: move |e| contents.set(e.value.clone()),
|
||||
oninput: move |e| contents.set(e.value()),
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user