2022-03-12 13:06:15 +00:00
|
|
|
use crate::services::field::*;
|
2022-04-07 12:15:00 +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-24 09:09:05 +00:00
|
|
|
let text_field = FieldBuilder::new(RichTextTypeOptionBuilder::default())
|
2022-03-12 13:06:15 +00:00
|
|
|
.name("Name")
|
|
|
|
.visibility(true)
|
|
|
|
.build();
|
|
|
|
|
2022-04-07 07:34:00 +00:00
|
|
|
// single select
|
2022-03-24 09:09:05 +00:00
|
|
|
let single_select = SingleSelectTypeOptionBuilder::default()
|
2022-03-12 13:06:15 +00:00
|
|
|
.option(SelectOption::new("Done"))
|
2022-03-16 08:10:35 +00:00
|
|
|
.option(SelectOption::new("Unknown"))
|
2022-03-12 13:06:15 +00:00
|
|
|
.option(SelectOption::new("Progress"));
|
2022-03-24 09:09:05 +00:00
|
|
|
let single_select_field = FieldBuilder::new(single_select).name("Status").visibility(true).build();
|
2022-03-12 13:06:15 +00:00
|
|
|
|
2022-04-07 07:34:00 +00:00
|
|
|
//multiple select
|
|
|
|
let multi_select = MultiSelectTypeOptionBuilder::default()
|
|
|
|
.option(SelectOption::new("A"))
|
|
|
|
.option(SelectOption::new("B"))
|
|
|
|
.option(SelectOption::new("C"));
|
|
|
|
let multi_select_field = FieldBuilder::new(multi_select)
|
|
|
|
.name("Alphabet")
|
|
|
|
.visibility(true)
|
|
|
|
.build();
|
|
|
|
|
2022-04-07 12:15:00 +00:00
|
|
|
let checkbox_field = FieldBuilder::from_field_type(&FieldType::Checkbox)
|
|
|
|
.name("isReady")
|
|
|
|
.visibility(true)
|
|
|
|
.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)
|
2022-04-07 07:34:00 +00:00
|
|
|
.add_field(multi_select_field)
|
2022-04-07 12:15:00 +00:00
|
|
|
.add_field(checkbox_field)
|
2022-03-12 13:06:15 +00:00
|
|
|
.add_empty_row()
|
|
|
|
.add_empty_row()
|
|
|
|
.add_empty_row()
|
|
|
|
.build()
|
|
|
|
}
|