AppFlowy/frontend/rust-lib/flowy-grid/src/util.rs

31 lines
950 B
Rust
Raw Normal View History

2022-03-12 13:06:15 +00:00
use crate::services::field::*;
2022-03-15 11:00:28 +00:00
use flowy_grid_data_model::entities::{BuildGridContext, FieldType};
2022-03-19 08:52:28 +00:00
use flowy_sync::client_grid::GridBuilder;
2022-03-12 13:06:15 +00:00
2022-03-15 11:00:28 +00:00
pub fn make_default_grid() -> BuildGridContext {
2022-03-14 09:24:25 +00:00
let text_field = FieldBuilder::new(RichTextTypeOptionsBuilder::default())
2022-03-12 13:06:15 +00:00
.name("Name")
.visibility(true)
.field_type(FieldType::RichText)
.build();
2022-03-14 09:24:25 +00:00
let single_select = SingleSelectTypeOptionsBuilder::default()
2022-03-12 13:06:15 +00:00
.option(SelectOption::new("Done"))
.option(SelectOption::new("Unknown"))
2022-03-12 13:06:15 +00:00
.option(SelectOption::new("Progress"));
let single_select_field = FieldBuilder::new(single_select)
.name("Status")
2022-03-12 13:06:15 +00:00
.visibility(true)
.field_type(FieldType::SingleSelect)
.build();
2022-03-15 11:00:28 +00:00
GridBuilder::default()
2022-03-12 13:06:15 +00:00
.add_field(text_field)
.add_field(single_select_field)
.add_empty_row()
.add_empty_row()
.add_empty_row()
.build()
}