Skip to content

Commit 0c45e3c

Browse files
committed
fix: remove default group for checkbox
1 parent 29e7e01 commit 0c45e3c

File tree

5 files changed

+17
-7
lines changed

5 files changed

+17
-7
lines changed

frontend/app_flowy/lib/plugins/board/presentation/board_page.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ class _BoardContentState extends State<BoardContent> {
8383
buildWhen: (previous, current) => previous.groupIds != current.groupIds,
8484
builder: (context, state) {
8585
final column = Column(
86+
crossAxisAlignment: CrossAxisAlignment.start,
8687
children: [const _ToolbarBlocAdaptor(), _buildBoard(context)],
8788
);
8889

frontend/rust-lib/flowy-grid/src/services/group/action.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ pub trait GroupAction: Send + Sync {
88
fn default_cell_rev(&self) -> Option<CellRevision> {
99
None
1010
}
11-
11+
fn use_default_group(&self) -> bool {
12+
true
13+
}
1214
fn can_group(&self, content: &str, cell_data: &Self::CellDataType) -> bool;
1315
fn add_row_if_match(&mut self, row_rev: &RowRevision, cell_data: &Self::CellDataType) -> Vec<GroupChangesetPB>;
1416
fn remove_row_if_match(&mut self, row_rev: &RowRevision, cell_data: &Self::CellDataType) -> Vec<GroupChangesetPB>;

frontend/rust-lib/flowy-grid/src/services/group/configuration.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,8 @@ where
9797
self.groups_map.values().collect()
9898
}
9999

100-
/// Returns the all the groups that contain the default group.
101-
pub(crate) fn clone_groups(&self) -> Vec<Group> {
102-
let mut groups: Vec<Group> = self.groups_map.values().cloned().collect();
103-
groups.push(self.default_group.clone());
104-
groups
100+
pub(crate) fn default_group(&self) -> &Group {
101+
&self.default_group
105102
}
106103

107104
/// Iterate mut the groups. The default group will be the last one that get mutated.

frontend/rust-lib/flowy-grid/src/services/group/controller.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,13 @@ where
182182
}
183183

184184
fn groups(&self) -> Vec<Group> {
185-
self.group_ctx.clone_groups()
185+
if self.use_default_group() {
186+
let mut groups: Vec<Group> = self.group_ctx.concrete_groups().into_iter().cloned().collect();
187+
groups.push(self.group_ctx.default_group().clone());
188+
groups
189+
} else {
190+
self.group_ctx.concrete_groups().into_iter().cloned().collect()
191+
}
186192
}
187193

188194
fn get_group(&self, group_id: &str) -> Option<(usize, Group)> {

frontend/rust-lib/flowy-grid/src/services/group/controller_impls/checkbox_controller.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ impl GroupAction for CheckboxGroupController {
2727
Some(CellRevision::new(UNCHECK.to_string()))
2828
}
2929

30+
fn use_default_group(&self) -> bool {
31+
false
32+
}
33+
3034
fn can_group(&self, content: &str, cell_data: &Self::CellDataType) -> bool {
3135
if cell_data.is_check() {
3236
content == CHECK

0 commit comments

Comments
 (0)