chore: refactor multi-select type option and add GroupPB

This commit is contained in:
appflowy
2022-08-11 13:04:45 +08:00
parent 29ea3c83c8
commit aae2d96a4f
34 changed files with 561 additions and 245 deletions

View File

@ -2,7 +2,7 @@ use flowy_grid::entities::FieldType;
use std::sync::Arc;
use flowy_grid::services::field::{
DateCellChangesetPB, MultiSelectTypeOption, SelectOptionPB, SingleSelectTypeOptionPB, SELECTION_IDS_SEPARATOR,
DateCellChangesetPB, MultiSelectTypeOptionPB, SelectOptionPB, SingleSelectTypeOptionPB, SELECTION_IDS_SEPARATOR,
};
use flowy_grid::services::row::RowRevisionBuilder;
use flowy_grid_data_model::revision::{FieldRevision, RowRevision};
@ -87,7 +87,7 @@ impl<'a> GridRowTestBuilder<'a> {
F: Fn(Vec<SelectOptionPB>) -> Vec<SelectOptionPB>,
{
let multi_select_field = self.field_rev_with_type(&FieldType::MultiSelect);
let type_option = MultiSelectTypeOption::from(&multi_select_field);
let type_option = MultiSelectTypeOptionPB::from(&multi_select_field);
let options = f(type_option.options);
let ops_ids = options
.iter()

View File

@ -3,7 +3,7 @@ use crate::grid::cell_test::script::GridCellTest;
use crate::grid::field_test::util::make_date_cell_string;
use flowy_grid::entities::{CellChangesetPB, FieldType};
use flowy_grid::services::field::selection_type_option::SelectOptionCellChangeset;
use flowy_grid::services::field::{MultiSelectTypeOption, SingleSelectTypeOptionPB};
use flowy_grid::services::field::{MultiSelectTypeOptionPB, SingleSelectTypeOptionPB};
#[tokio::test]
async fn grid_cell_update() {
@ -28,7 +28,7 @@ async fn grid_cell_update() {
SelectOptionCellChangeset::from_insert(&type_option.options.first().unwrap().id).to_str()
}
FieldType::MultiSelect => {
let type_option = MultiSelectTypeOption::from(field_rev);
let type_option = MultiSelectTypeOptionPB::from(field_rev);
SelectOptionCellChangeset::from_insert(&type_option.options.first().unwrap().id).to_str()
}
FieldType::Checkbox => "1".to_string(),

View File

@ -75,7 +75,7 @@ impl GridEditorTest {
.row_revs
}
pub async fn grid_filters(&self) -> Vec<GridFilter> {
pub async fn grid_filters(&self) -> Vec<GridFilterConfiguration> {
let layout_type = GridLayoutType::Table;
self.editor.get_grid_filter(&layout_type).await.unwrap()
}

View File

@ -2,7 +2,7 @@ use crate::grid::script::EditorScript::*;
use crate::grid::script::*;
use chrono::NaiveDateTime;
use flowy_grid::services::field::{
DateCellContentChangeset, DateCellData, MultiSelectTypeOption, SelectOption, SelectOptionCellContentChangeset,
DateCellContentChangeset, DateCellData, MultiSelectTypeOptionPB, SelectOption, SelectOptionCellContentChangeset,
SingleSelectTypeOption, SELECTION_IDS_SEPARATOR,
};
use flowy_grid::services::row::{decode_cell_data_from_type_option_cell_data, CreateRowMetaBuilder};
@ -250,7 +250,7 @@ async fn grid_row_add_cells_test() {
builder.add_select_option_cell(&field.id, option.id.clone()).unwrap();
}
FieldType::MultiSelect => {
let type_option = MultiSelectTypeOption::from(field);
let type_option = MultiSelectTypeOptionPB::from(field);
let ops_ids = type_option
.options
.iter()
@ -327,7 +327,7 @@ async fn grid_cell_update() {
SelectOptionCellContentChangeset::from_insert(&type_option.options.first().unwrap().id).to_str()
}
FieldType::MultiSelect => {
let type_option = MultiSelectTypeOption::from(field_meta);
let type_option = MultiSelectTypeOptionPB::from(field_meta);
SelectOptionCellContentChangeset::from_insert(&type_option.options.first().unwrap().id).to_str()
}
FieldType::Checkbox => "1".to_string(),