Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanceras committed Apr 6, 2024
1 parent 0d09765 commit 9be5e32
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 37 deletions.
5 changes: 2 additions & 3 deletions examples/data-viewer/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
11 changes: 5 additions & 6 deletions examples/data-viewer/src/views/column_view.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down Expand Up @@ -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()),
Expand Down
21 changes: 10 additions & 11 deletions examples/data-viewer/src/views/data_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use sauron::{
units::*,
*,
},
Component, Effects, Node, style
style, Component, Effects, Node,
};
use std::{
cell::RefCell,
Expand Down Expand Up @@ -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()),
},
Expand Down Expand Up @@ -153,17 +153,17 @@ 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",
},
],
[section(
[
class("normal_column_names__frozen_rows"),
style!{
style! {
margin_left: px(-self.scroll_left)
}
},
],
[
// can move left and right
Expand All @@ -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",
},
Expand Down Expand Up @@ -406,17 +406,16 @@ 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<Msg> {
// can move up and down
ol(
[
class("data_view__frozen_columns"),
style!{
style! {
margin_top: px(-self.scroll_top),
}
},
],
self.page_views
.iter()
Expand Down Expand Up @@ -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| {
Expand Down Expand Up @@ -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()),
},
Expand Down
9 changes: 4 additions & 5 deletions examples/data-viewer/src/views/field_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ use sauron::{
units::px,
*,
},
style,
Attribute, Component, Effects, Node,
style, Attribute, Component, Effects, Node,
};

#[derive(Debug, PartialEq)]
Expand Down Expand Up @@ -133,14 +132,14 @@ impl FieldView {
}

fn css_size(&self) -> Attribute<Msg> {
style!{
width: px(self.width),
style! {
width: px(self.width),
height: px(self.height)
}
}

fn css_padding(&self) -> Attribute<Msg> {
style!{
style! {
padding:
[
px(Self::padding_top()),
Expand Down
10 changes: 4 additions & 6 deletions examples/data-viewer/src/views/page_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ use sauron::{
units::*,
*,
},
Component, Effects, Node,
style
style, Component, Effects, Node,
};

#[derive(Debug, PartialEq)]
Expand Down Expand Up @@ -91,7 +90,7 @@ impl Component for PageView {
div(
[
class("page_view__page_holder"),
style!{height: px(self.height())},
style! {height: px(self.height())},
],
[],
)
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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)),
Expand All @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions examples/data-viewer/src/views/row_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -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),
],
Expand Down
4 changes: 2 additions & 2 deletions examples/data-viewer/src/widgets.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use sauron::{
html::{attributes::*, units::px, *},
Attribute, Node, style
style, Attribute, Node,
};
use search_widget::SearchWidget;

Expand Down Expand Up @@ -69,7 +69,7 @@ pub(crate) fn selector_box<MSG>(
[
r#type("checkbox"),
class("selector_box__checkbox"),
style!{width: px(30)},
style! {width: px(30)},
],
[],
)
Expand Down
4 changes: 2 additions & 2 deletions examples/data-viewer/src/widgets/search_widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::assets;

use sauron::{
html::{attributes::*, units::px, *},
Attribute, Node, style,
style, Attribute, Node,
};

pub struct SearchWidget {}
Expand All @@ -26,7 +26,7 @@ impl SearchWidget {
[
r#type("text"),
class("search_widget__column_filter"),
style!{width: px(input_width)},
style! {width: px(input_width)},
],
[],
)
Expand Down

0 comments on commit 9be5e32

Please sign in to comment.