Skip to content

Commit c97cb7c

Browse files
authored
Merge pull request #983 from AppFlowy-IO/feat/disable_unsupport_group_field
chore: disable group field that does not support grouping
2 parents a5cbb82 + 4de0008 commit c97cb7c

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

frontend/app_flowy/lib/plugins/grid/application/field/field_controller.dart

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,5 +290,26 @@ class GridFieldContext {
290290

291291
bool get isGroupField => _isGroupField;
292292

293+
bool get canGroup {
294+
switch (_field.fieldType) {
295+
case FieldType.Checkbox:
296+
return true;
297+
case FieldType.DateTime:
298+
return false;
299+
case FieldType.MultiSelect:
300+
return true;
301+
case FieldType.Number:
302+
return false;
303+
case FieldType.RichText:
304+
return false;
305+
case FieldType.SingleSelect:
306+
return true;
307+
case FieldType.URL:
308+
return false;
309+
}
310+
311+
return false;
312+
}
313+
293314
GridFieldContext({required FieldPB field}) : _field = field;
294315
}

frontend/app_flowy/lib/plugins/grid/presentation/widgets/toolbar/grid_group.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,15 @@ class GridGroupList extends StatelessWidget {
3131
child: BlocBuilder<GridGroupBloc, GridGroupState>(
3232
builder: (context, state) {
3333
final cells = state.fieldContexts.map((fieldContext) {
34-
return _GridGroupCell(
34+
Widget cell = _GridGroupCell(
3535
fieldContext: fieldContext,
3636
key: ValueKey(fieldContext.id),
3737
);
38+
39+
if (!fieldContext.canGroup) {
40+
cell = IgnorePointer(child: Opacity(opacity: 0.3, child: cell));
41+
}
42+
return cell;
3843
}).toList();
3944

4045
return ListView.separated(

frontend/app_flowy/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ packages:
3535
path: "packages/appflowy_editor"
3636
relative: true
3737
source: path
38-
version: "0.0.3"
38+
version: "0.0.4"
3939
args:
4040
dependency: transitive
4141
description:

0 commit comments

Comments
 (0)