Groups can now be ordered (via drag and drop)
This commit is contained in:
parent
16c484c2d1
commit
975d1ceee2
14 changed files with 461 additions and 54 deletions
|
|
@ -1,4 +1,4 @@
|
|||
use gloo::utils::document;
|
||||
use gloo::{console::log, utils::document};
|
||||
use wasm_bindgen::prelude::*;
|
||||
use web_sys::Element;
|
||||
|
||||
|
|
@ -6,6 +6,10 @@ pub trait SelectorExt {
|
|||
fn selector<T>(&self, selectors: &str) -> T
|
||||
where
|
||||
T: JsCast;
|
||||
|
||||
fn selector_all<T>(&self, selectors: &str) -> Vec<T>
|
||||
where
|
||||
T: JsCast;
|
||||
}
|
||||
|
||||
impl SelectorExt for Element {
|
||||
|
|
@ -19,6 +23,18 @@ impl SelectorExt for Element {
|
|||
.dyn_into::<T>()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn selector_all<T>(&self, selectors: &str) -> Vec<T>
|
||||
where
|
||||
T: JsCast,
|
||||
{
|
||||
self.query_selector_all(selectors)
|
||||
.unwrap()
|
||||
.values()
|
||||
.into_iter()
|
||||
.map(|e| e.unwrap().dyn_into::<T>().unwrap())
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn selector<T>(selectors: &str) -> T
|
||||
|
|
@ -33,6 +49,19 @@ where
|
|||
.unwrap()
|
||||
}
|
||||
|
||||
pub fn selector_all<T>(selectors: &str) -> Vec<T>
|
||||
where
|
||||
T: JsCast,
|
||||
{
|
||||
document()
|
||||
.query_selector_all(selectors)
|
||||
.unwrap()
|
||||
.values()
|
||||
.into_iter()
|
||||
.map(|e| e.unwrap().dyn_into::<T>().unwrap())
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn selector_and_clone<T>(selectors: &str) -> T
|
||||
where
|
||||
T: JsCast,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue