feat: add indexmap dependency
This commit is contained in:
1 parent
04ba0ff1ea
commit
0816f2da8b
4 files changed
+9
-3
No files matched your search
Generated
+3
@@ -1869,6 +1869,8 @@ checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown 0.16.1",
|
||||
"serde",
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3026,6 +3028,7 @@ dependencies = [
|
||||
"chrono",
|
||||
"console_error_panic_hook",
|
||||
"icondata",
|
||||
"indexmap",
|
||||
"leptos",
|
||||
"leptos_animate",
|
||||
"leptos_axum",
|
||||
|
||||
@@ -29,6 +29,7 @@ macros = { path = "./macros" }
|
||||
traits = { path = "./traits" }
|
||||
icondata = { version = "0.7.0", features = ["font-awesome"] }
|
||||
leptos_icons = "0.7.1"
|
||||
indexmap = { version = "2.13.0", features = ["serde"] }
|
||||
|
||||
[features]
|
||||
default = ["ssr"]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use std::collections::HashMap;
|
||||
use indexmap::IndexMap;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
@@ -67,7 +68,7 @@ pub struct SchemaNode {
|
||||
pub item_template: Option<Box<SchemaNode>>,
|
||||
/// When used with a SchemaType::Map, this determines what children from the map are displayed
|
||||
/// and how. It is ignored with all other SchemaType variants.
|
||||
pub children: HashMap<String, SchemaNode>,
|
||||
pub children: IndexMap<String, SchemaNode>,
|
||||
}
|
||||
|
||||
impl SchemaNode {
|
||||
@@ -76,7 +77,7 @@ impl SchemaNode {
|
||||
data_type,
|
||||
header: "".to_string(),
|
||||
item_template: None,
|
||||
children: HashMap::new(),
|
||||
children: IndexMap::new(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use crate::common::{SchemaNode, SchemaType, ValueType};
|
||||
use leptos::prelude::*;
|
||||
use std::collections::HashMap;
|
||||
use indexmap::IndexMap;
|
||||
use leptos::logging::debug_log;
|
||||
|
||||
#[component]
|
||||
@@ -134,7 +135,7 @@ fn ListDisplay(
|
||||
fn MapDisplay(
|
||||
#[prop(into)] value: Signal<ValueType>,
|
||||
#[prop(into)] header: Signal<String>,
|
||||
#[prop(into)] schema: Signal<HashMap<String, SchemaNode>>,
|
||||
#[prop(into)] schema: Signal<IndexMap<String, SchemaNode>>,
|
||||
) -> impl IntoView {
|
||||
// Unwrap the value and check if it is the correct type. It must be a ValueType::Map.
|
||||
let display_map = Memo::new(move |_| {
|
||||
|
||||
Reference in new issue
Block a user