2022-08-23 20:36:28 +08:00
|
|
|
use crate::entities::GroupChangesetPB;
|
2022-08-20 15:40:13 +08:00
|
|
|
|
2022-08-22 16:16:15 +08:00
|
|
|
use crate::services::group::controller::MoveGroupRowContext;
|
2022-09-04 23:11:05 +08:00
|
|
|
use flowy_grid_data_model::revision::{CellRevision, RowRevision};
|
2022-08-20 15:40:13 +08:00
|
|
|
|
|
|
|
pub trait GroupAction: Send + Sync {
|
|
|
|
type CellDataType;
|
2022-09-04 23:11:05 +08:00
|
|
|
fn default_cell_rev(&self) -> Option<CellRevision> {
|
|
|
|
None
|
|
|
|
}
|
|
|
|
|
2022-08-20 15:40:13 +08:00
|
|
|
fn can_group(&self, content: &str, cell_data: &Self::CellDataType) -> bool;
|
2022-08-23 20:36:28 +08:00
|
|
|
fn add_row_if_match(&mut self, row_rev: &RowRevision, cell_data: &Self::CellDataType) -> Vec<GroupChangesetPB>;
|
|
|
|
fn remove_row_if_match(&mut self, row_rev: &RowRevision, cell_data: &Self::CellDataType) -> Vec<GroupChangesetPB>;
|
|
|
|
fn move_row(&mut self, cell_data: &Self::CellDataType, context: MoveGroupRowContext) -> Vec<GroupChangesetPB>;
|
2022-08-20 15:40:13 +08:00
|
|
|
}
|