From 0816f2da8be19d3c19c39aed1efb17015f53ea23 Mon Sep 17 00:00:00 2001 From: Lucas Vas Date: Wed, 18 Feb 2026 09:00:15 -0500 Subject: [PATCH] feat: add indexmap dependency --- Cargo.lock | 3 +++ Cargo.toml | 1 + src/common/schema_node.rs | 5 +++-- src/components/data_display.rs | 3 ++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 963391a..5290b50 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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", diff --git a/Cargo.toml b/Cargo.toml index 749ffdd..c29aaf5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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"] diff --git a/src/common/schema_node.rs b/src/common/schema_node.rs index 06062cd..2e1f943 100644 --- a/src/common/schema_node.rs +++ b/src/common/schema_node.rs @@ -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>, /// 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, + pub children: IndexMap, } impl SchemaNode { @@ -76,7 +77,7 @@ impl SchemaNode { data_type, header: "".to_string(), item_template: None, - children: HashMap::new(), + children: IndexMap::new(), } } diff --git a/src/components/data_display.rs b/src/components/data_display.rs index 036fde6..5c2a1d1 100644 --- a/src/components/data_display.rs +++ b/src/components/data_display.rs @@ -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, #[prop(into)] header: Signal, - #[prop(into)] schema: Signal>, + #[prop(into)] schema: Signal>, ) -> 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 |_| {