diff --git a/examples/data-viewer/src/lib.rs b/examples/data-viewer/src/lib.rs index 4d93677d..06bc8892 100644 --- a/examples/data-viewer/src/lib.rs +++ b/examples/data-viewer/src/lib.rs @@ -1,20 +1,19 @@ #![deny(warnings)] +pub use app::App; pub use error::Error; use log::Level; pub use restq::{ast::ddl::DataTypeDef, ColumnDef, DataType, DataValue}; use sauron::*; use views::DataView; -pub use app::App; #[macro_use] extern crate log; +pub(crate) mod app; pub(crate) mod assets; mod error; mod views; pub(crate) mod widgets; -pub(crate) mod app; - #[wasm_bindgen] pub fn initialize(initial_state: &str) { diff --git a/examples/data-viewer/src/views/column_view.rs b/examples/data-viewer/src/views/column_view.rs index 968633f0..be1cbc6c 100644 --- a/examples/data-viewer/src/views/column_view.rs +++ b/examples/data-viewer/src/views/column_view.rs @@ -1,8 +1,7 @@ use crate::{assets, widgets::search_widget, ColumnDef}; use sauron::{ html::{attributes::*, events::*, units::*, *}, - Component, Effects, Node, - style + style, Component, Effects, Node, }; #[derive(Debug, PartialEq)] @@ -88,16 +87,16 @@ impl ColumnView { [ class("column_view__controls flex-column"), classes_flag([("column_view__controls--frozen", self.is_frozen)]), - style!{ - height: px(self.height), + style! { + height: px(self.height), width: px(controls_width), - } + }, ], [ div( [ class("column_controls flex-row"), - style!{ + style! { width: px(self_width), padding_left: px(Self::side_padding_width()), padding_right: px(Self::side_padding_width()), diff --git a/examples/data-viewer/src/views/data_view.rs b/examples/data-viewer/src/views/data_view.rs index bf3883a8..58069749 100644 --- a/examples/data-viewer/src/views/data_view.rs +++ b/examples/data-viewer/src/views/data_view.rs @@ -11,7 +11,7 @@ use sauron::{ units::*, *, }, - Component, Effects, Node, style + style, Component, Effects, Node, }; use std::{ cell::RefCell, @@ -117,7 +117,7 @@ impl Component for DataView { main( [ class("data_view grid"), - style!{ + style! { width: px(self.allocated_width - 40), min_width: px(self.calculate_min_width()), }, @@ -153,7 +153,7 @@ impl Component for DataView { section( [ class("data_view__normal_column_names__frozen_rows"), - style!{ + style! { width: px(self.calculate_normal_rows_width()), overflow_x: "hidden", }, @@ -161,9 +161,9 @@ impl Component for DataView { [section( [ class("normal_column_names__frozen_rows"), - style!{ + style! { margin_left: px(-self.scroll_left) - } + }, ], [ // can move left and right @@ -177,7 +177,7 @@ impl Component for DataView { section( [ class("data_view__frozen_columns_container"), - style!{ + style! { height: px(self.calculate_normal_rows_height()), overflow_y: "hidden", }, @@ -406,7 +406,6 @@ impl DataView { self.scrollbar_to_bottom() <= scroll_bottom_allowance } - /// These are values in a row that is under the frozen columns /// Can move up and down fn view_frozen_columns(&self) -> Node { @@ -414,9 +413,9 @@ impl DataView { ol( [ class("data_view__frozen_columns"), - style!{ + style! { margin_top: px(-self.scroll_top), - } + }, ], self.page_views .iter() @@ -470,7 +469,7 @@ impl DataView { div( [ class("column_view__grip column_view__grip--right"), - style!{ + style! { width: px(ColumnView::grip_width()), }, on_mousedown(move |event| { @@ -529,7 +528,7 @@ impl DataView { div( [ class("data_view__normal_rows flex-column"), - style!{ + style! { width: px(self.calculate_normal_rows_width()), height: px(self.calculate_normal_rows_height()), }, diff --git a/examples/data-viewer/src/views/field_view.rs b/examples/data-viewer/src/views/field_view.rs index 28bbda2f..aeaacef9 100644 --- a/examples/data-viewer/src/views/field_view.rs +++ b/examples/data-viewer/src/views/field_view.rs @@ -7,8 +7,7 @@ use sauron::{ units::px, *, }, - style, - Attribute, Component, Effects, Node, + style, Attribute, Component, Effects, Node, }; #[derive(Debug, PartialEq)] @@ -133,14 +132,14 @@ impl FieldView { } fn css_size(&self) -> Attribute { - style!{ - width: px(self.width), + style! { + width: px(self.width), height: px(self.height) } } fn css_padding(&self) -> Attribute { - style!{ + style! { padding: [ px(Self::padding_top()), diff --git a/examples/data-viewer/src/views/page_view.rs b/examples/data-viewer/src/views/page_view.rs index 11493029..f82df71e 100644 --- a/examples/data-viewer/src/views/page_view.rs +++ b/examples/data-viewer/src/views/page_view.rs @@ -9,8 +9,7 @@ use sauron::{ units::*, *, }, - Component, Effects, Node, - style + style, Component, Effects, Node, }; #[derive(Debug, PartialEq)] @@ -91,7 +90,7 @@ impl Component for PageView { div( [ class("page_view__page_holder"), - style!{height: px(self.height())}, + style! {height: px(self.height())}, ], [], ) @@ -168,7 +167,6 @@ impl PageView { }) } - /// Keep updating which columns are frozen /// call these when new rows are set or added pub fn update_freeze_columns(&mut self) { @@ -214,7 +212,7 @@ impl PageView { "page_view__frozen_columns__selector__frozen_column_rows flex-row", )], [ - selector_box(false, [], [style!{width: px(30)}]), + selector_box(false, [], [style! {width: px(30)}]), row_view .view_frozen_columns() .map_msg(move |row_msg| Msg::RowMsg(index, row_msg)), @@ -240,7 +238,7 @@ impl PageView { selector_box( false, [class("immovable_rows__selector_box")], - [style!{width: px(30)}], + [style! {width: px(30)}], ), row_view .view_immovable_fields() diff --git a/examples/data-viewer/src/views/row_view.rs b/examples/data-viewer/src/views/row_view.rs index 599643fb..f80b661e 100644 --- a/examples/data-viewer/src/views/row_view.rs +++ b/examples/data-viewer/src/views/row_view.rs @@ -2,7 +2,7 @@ use crate::views::{field_view, FieldView}; use restq::{ColumnDef, DataValue}; use sauron::{ html::{attributes::*, events::*, units::*, *}, - Component, Effects, Node, style + style, Component, Effects, Node, }; use std::{cell::RefCell, rc::Rc}; @@ -99,7 +99,7 @@ impl RowView { ("row_view--frozen_row", self.is_frozen), ("row_view--modified", self.is_changed()), ]), - style!{height: px(Self::row_height())}, + style! {height: px(Self::row_height())}, on_click(|_| Msg::Click), on_dblclick(|_| Msg::DoubleClick), ], diff --git a/examples/data-viewer/src/widgets.rs b/examples/data-viewer/src/widgets.rs index 81814b87..837e3805 100644 --- a/examples/data-viewer/src/widgets.rs +++ b/examples/data-viewer/src/widgets.rs @@ -1,6 +1,6 @@ use sauron::{ html::{attributes::*, units::px, *}, - Attribute, Node, style + style, Attribute, Node, }; use search_widget::SearchWidget; @@ -69,7 +69,7 @@ pub(crate) fn selector_box( [ r#type("checkbox"), class("selector_box__checkbox"), - style!{width: px(30)}, + style! {width: px(30)}, ], [], ) diff --git a/examples/data-viewer/src/widgets/search_widget.rs b/examples/data-viewer/src/widgets/search_widget.rs index e917bf47..c94d733d 100644 --- a/examples/data-viewer/src/widgets/search_widget.rs +++ b/examples/data-viewer/src/widgets/search_widget.rs @@ -2,7 +2,7 @@ use crate::assets; use sauron::{ html::{attributes::*, units::px, *}, - Attribute, Node, style, + style, Attribute, Node, }; pub struct SearchWidget {} @@ -26,7 +26,7 @@ impl SearchWidget { [ r#type("text"), class("search_widget__column_filter"), - style!{width: px(input_width)}, + style! {width: px(input_width)}, ], [], )