wip: pass more events
This commit is contained in:
1 parent
47d0f51e00
commit
0dad91bc08
20 files changed
+773
-31
No files matched your search
@@ -1,9 +1,13 @@
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
use std::{collections::HashMap, fmt::Debug, sync::Arc};
|
||||
|
||||
use dioxus_core::UiEvent;
|
||||
|
||||
pub type FormEvent = UiEvent<FormData>;
|
||||
|
||||
/* DOMEvent: Send + SyncTarget relatedTarget */
|
||||
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[derive(Clone)]
|
||||
pub struct FormEvent {
|
||||
pub struct FormData {
|
||||
pub value: String,
|
||||
|
||||
pub values: HashMap<String, String>,
|
||||
@@ -12,6 +16,15 @@ pub struct FormEvent {
|
||||
pub files: Option<Arc<dyn FileEngine>>,
|
||||
}
|
||||
|
||||
impl Debug for FormData {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("FormEvent")
|
||||
.field("value", &self.value)
|
||||
.field("values", &self.values)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait::async_trait(?Send)]
|
||||
pub trait FileEngine {
|
||||
// get a list of file names
|
||||
@@ -25,7 +38,7 @@ pub trait FileEngine {
|
||||
}
|
||||
|
||||
impl_event! {
|
||||
FormEvent;
|
||||
FormData;
|
||||
|
||||
/// onchange
|
||||
onchange
|
||||
|
||||
Reference in new issue
Block a user