17 lines
737 B
Rust
Raw Normal View History

use crate::entities::GroupChangesetPB;
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};
pub trait GroupAction: Send + Sync {
type CellDataType;
2022-09-04 23:11:05 +08:00
fn default_cell_rev(&self) -> Option<CellRevision> {
None
}
fn can_group(&self, content: &str, cell_data: &Self::CellDataType) -> bool;
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>;
}