소스 검색

chore: add suffix PB to dart class

appflowy 2 년 전
부모
커밋
e45b14910b
61개의 변경된 파일412개의 추가작업 그리고 412개의 파일을 삭제
  1. 1 1
      frontend/app_flowy/lib/core/grid_notification.dart
  2. 1 1
      frontend/app_flowy/lib/startup/deps_resolver.dart
  3. 2 2
      frontend/app_flowy/lib/workspace/application/grid/block/block_listener.dart
  4. 10 10
      frontend/app_flowy/lib/workspace/application/grid/cell/cell_service/cell_data_loader.dart
  5. 3 3
      frontend/app_flowy/lib/workspace/application/grid/cell/cell_service/cell_data_persistence.dart
  6. 2 2
      frontend/app_flowy/lib/workspace/application/grid/cell/cell_service/cell_field_notifier.dart
  7. 4 4
      frontend/app_flowy/lib/workspace/application/grid/cell/cell_service/cell_service.dart
  8. 7 7
      frontend/app_flowy/lib/workspace/application/grid/cell/cell_service/context_builder.dart
  9. 6 6
      frontend/app_flowy/lib/workspace/application/grid/cell/date_cal_bloc.dart
  10. 7 7
      frontend/app_flowy/lib/workspace/application/grid/cell/date_cell_bloc.dart
  11. 2 2
      frontend/app_flowy/lib/workspace/application/grid/cell/select_option_cell_bloc.dart
  12. 11 11
      frontend/app_flowy/lib/workspace/application/grid/cell/select_option_editor_bloc.dart
  13. 12 12
      frontend/app_flowy/lib/workspace/application/grid/cell/select_option_service.dart
  14. 1 1
      frontend/app_flowy/lib/workspace/application/grid/cell/url_cell_bloc.dart
  15. 1 1
      frontend/app_flowy/lib/workspace/application/grid/cell/url_cell_editor_bloc.dart
  16. 4 4
      frontend/app_flowy/lib/workspace/application/grid/field/field_action_sheet_bloc.dart
  17. 2 2
      frontend/app_flowy/lib/workspace/application/grid/field/field_cell_bloc.dart
  18. 3 3
      frontend/app_flowy/lib/workspace/application/grid/field/field_editor_bloc.dart
  19. 2 2
      frontend/app_flowy/lib/workspace/application/grid/field/field_listener.dart
  20. 23 23
      frontend/app_flowy/lib/workspace/application/grid/field/field_service.dart
  21. 2 2
      frontend/app_flowy/lib/workspace/application/grid/field/field_type_option_edit_bloc.dart
  22. 2 2
      frontend/app_flowy/lib/workspace/application/grid/field/grid_listenr.dart
  23. 6 6
      frontend/app_flowy/lib/workspace/application/grid/field/type_option/edit_select_option_bloc.dart
  24. 5 5
      frontend/app_flowy/lib/workspace/application/grid/field/type_option/multi_select_type_option.dart
  25. 11 11
      frontend/app_flowy/lib/workspace/application/grid/field/type_option/select_option_type_option_bloc.dart
  26. 9 9
      frontend/app_flowy/lib/workspace/application/grid/field/type_option/single_select_type_option.dart
  27. 5 5
      frontend/app_flowy/lib/workspace/application/grid/field/type_option/type_option_service.dart
  28. 8 8
      frontend/app_flowy/lib/workspace/application/grid/grid_bloc.dart
  29. 6 6
      frontend/app_flowy/lib/workspace/application/grid/grid_header_bloc.dart
  30. 23 23
      frontend/app_flowy/lib/workspace/application/grid/grid_service.dart
  31. 3 3
      frontend/app_flowy/lib/workspace/application/grid/prelude.dart
  32. 2 2
      frontend/app_flowy/lib/workspace/application/grid/row/row_bloc.dart
  33. 3 3
      frontend/app_flowy/lib/workspace/application/grid/row/row_listener.dart
  34. 21 21
      frontend/app_flowy/lib/workspace/application/grid/row/row_service.dart
  35. 4 4
      frontend/app_flowy/lib/workspace/application/grid/setting/property_bloc.dart
  36. 1 1
      frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/layout/layout.dart
  37. 22 22
      frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/select_option_cell/extension.dart
  38. 1 1
      frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/select_option_cell/select_option_cell.dart
  39. 2 2
      frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/select_option_cell/select_option_editor.dart
  40. 2 2
      frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/select_option_cell/text_field.dart
  41. 1 1
      frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_cell.dart
  42. 3 3
      frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_type_option_editor.dart
  43. 1 1
      frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/grid_header.dart
  44. 4 4
      frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/type_option/select_option.dart
  45. 5 5
      frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/type_option/select_option_editor.dart
  46. 1 1
      frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/toolbar/grid_property.dart
  47. 1 1
      frontend/app_flowy/lib/workspace/presentation/widgets/emoji_picker/src/emoji_lists.dart
  48. 23 23
      frontend/rust-lib/flowy-grid/src/entities/cell_entities.rs
  49. 44 44
      frontend/rust-lib/flowy-grid/src/entities/field_entities.rs
  50. 2 2
      frontend/rust-lib/flowy-grid/src/entities/grid_entities.rs
  51. 20 20
      frontend/rust-lib/flowy-grid/src/event_handler.rs
  52. 25 25
      frontend/rust-lib/flowy-grid/src/event_map.rs
  53. 3 3
      frontend/rust-lib/flowy-grid/src/services/block_manager.rs
  54. 2 2
      frontend/rust-lib/flowy-grid/src/services/field/field_builder.rs
  55. 7 7
      frontend/rust-lib/flowy-grid/src/services/field/type_options/date_type_option/date_type_option_entities.rs
  56. 8 8
      frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option/select_option.rs
  57. 11 11
      frontend/rust-lib/flowy-grid/src/services/grid_editor.rs
  58. 3 3
      frontend/rust-lib/flowy-grid/tests/grid/block_test/script.rs
  59. 2 2
      frontend/rust-lib/flowy-grid/tests/grid/cell_test/script.rs
  60. 2 2
      frontend/rust-lib/flowy-grid/tests/grid/cell_test/test.rs
  61. 2 2
      frontend/rust-lib/flowy-grid/tests/grid/field_test/util.rs

+ 1 - 1
frontend/app_flowy/lib/core/grid_notification.dart

@@ -8,7 +8,7 @@ import 'package:flowy_sdk/rust_stream.dart';
 
 import 'notification_helper.dart';
 
-// Grid
+// GridPB
 typedef GridNotificationCallback = void Function(GridNotification, Either<Uint8List, FlowyError>);
 
 class GridNotificationParser extends NotificationParser<GridNotification, FlowyError> {

+ 1 - 1
frontend/app_flowy/lib/startup/deps_resolver.dart

@@ -134,7 +134,7 @@ void _resolveDocDeps(GetIt getIt) {
 }
 
 void _resolveGridDeps(GetIt getIt) {
-  // Grid
+  // GridPB
   getIt.registerFactoryParam<GridBloc, View, void>(
     (view, _) => GridBloc(view: view),
   );

+ 2 - 2
frontend/app_flowy/lib/workspace/application/grid/block/block_listener.dart

@@ -7,7 +7,7 @@ import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
 import 'package:flowy_sdk/protobuf/flowy-grid/block_entities.pb.dart';
 import 'package:flowy_sdk/protobuf/flowy-grid/dart_notification.pb.dart';
 
-typedef GridBlockUpdateNotifierValue = Either<List<GridBlockChangeset>, FlowyError>;
+typedef GridBlockUpdateNotifierValue = Either<List<GridBlockChangesetPB>, FlowyError>;
 
 class GridBlockListener {
   final String blockId;
@@ -33,7 +33,7 @@ class GridBlockListener {
     switch (ty) {
       case GridNotification.DidUpdateGridBlock:
         result.fold(
-          (payload) => _rowsUpdateNotifier?.value = left([GridBlockChangeset.fromBuffer(payload)]),
+          (payload) => _rowsUpdateNotifier?.value = left([GridBlockChangesetPB.fromBuffer(payload)]),
           (error) => _rowsUpdateNotifier?.value = right(error),
         );
         break;

+ 10 - 10
frontend/app_flowy/lib/workspace/application/grid/cell/cell_service/cell_data_loader.dart

@@ -24,7 +24,7 @@ class GridCellDataLoader<T> {
   Future<T?> loadData() {
     final fut = service.getCell(cellId: cellId);
     return fut.then(
-      (result) => result.fold((Cell cell) {
+      (result) => result.fold((GridCellPB cell) {
         try {
           return parser.parserData(cell.data);
         } catch (e, s) {
@@ -48,32 +48,32 @@ class StringCellDataParser implements ICellDataParser<String> {
   }
 }
 
-class DateCellDataParser implements ICellDataParser<DateCellData> {
+class DateCellDataParser implements ICellDataParser<DateCellDataPB> {
   @override
-  DateCellData? parserData(List<int> data) {
+  DateCellDataPB? parserData(List<int> data) {
     if (data.isEmpty) {
       return null;
     }
-    return DateCellData.fromBuffer(data);
+    return DateCellDataPB.fromBuffer(data);
   }
 }
 
-class SelectOptionCellDataParser implements ICellDataParser<SelectOptionCellData> {
+class SelectOptionCellDataParser implements ICellDataParser<SelectOptionCellDataPB> {
   @override
-  SelectOptionCellData? parserData(List<int> data) {
+  SelectOptionCellDataPB? parserData(List<int> data) {
     if (data.isEmpty) {
       return null;
     }
-    return SelectOptionCellData.fromBuffer(data);
+    return SelectOptionCellDataPB.fromBuffer(data);
   }
 }
 
-class URLCellDataParser implements ICellDataParser<URLCellData> {
+class URLCellDataParser implements ICellDataParser<URLCellDataPB> {
   @override
-  URLCellData? parserData(List<int> data) {
+  URLCellDataPB? parserData(List<int> data) {
     if (data.isEmpty) {
       return null;
     }
-    return URLCellData.fromBuffer(data);
+    return URLCellDataPB.fromBuffer(data);
   }
 }

+ 3 - 3
frontend/app_flowy/lib/workspace/application/grid/cell/cell_service/cell_data_persistence.dart

@@ -40,7 +40,7 @@ class DateCellDataPersistence implements IGridCellDataPersistence<CalendarData>
 
   @override
   Future<Option<FlowyError>> save(CalendarData data) {
-    var payload = DateChangesetPayload.create()..cellIdentifier = _makeCellIdPayload(cellId);
+    var payload = DateChangesetPayloadPB.create()..cellIdentifier = _makeCellIdPayload(cellId);
 
     final date = (data.date.millisecondsSinceEpoch ~/ 1000).toString();
     payload.date = date;
@@ -58,8 +58,8 @@ class DateCellDataPersistence implements IGridCellDataPersistence<CalendarData>
   }
 }
 
-CellIdentifierPayload _makeCellIdPayload(GridCellIdentifier cellId) {
-  return CellIdentifierPayload.create()
+GridCellIdentifierPayloadPB _makeCellIdPayload(GridCellIdentifier cellId) {
+  return GridCellIdentifierPayloadPB.create()
     ..gridId = cellId.gridId
     ..fieldId = cellId.fieldId
     ..rowId = cellId.rowId;

+ 2 - 2
frontend/app_flowy/lib/workspace/application/grid/cell/cell_service/cell_field_notifier.dart

@@ -4,11 +4,11 @@ import 'package:flutter/foundation.dart';
 import 'cell_service.dart';
 
 abstract class GridFieldChangedNotifier {
-  void onFieldChanged(void Function(Field) callback);
+  void onFieldChanged(void Function(GridFieldPB) callback);
   void dispose();
 }
 
-/// Grid's cell helper wrapper that enables each cell will get notified when the corresponding field was changed.
+/// GridPB's cell helper wrapper that enables each cell will get notified when the corresponding field was changed.
 /// You Register an onFieldChanged callback to listen to the cell changes, and unregister if you don't want to listen.
 class GridCellFieldNotifier {
   /// fieldId: {objectId: callback}

+ 4 - 4
frontend/app_flowy/lib/workspace/application/grid/cell/cell_service/cell_service.dart

@@ -35,7 +35,7 @@ class CellService {
     required GridCellIdentifier cellId,
     required String data,
   }) {
-    final payload = CellChangeset.create()
+    final payload = CellChangesetPB.create()
       ..gridId = cellId.gridId
       ..fieldId = cellId.fieldId
       ..rowId = cellId.rowId
@@ -43,10 +43,10 @@ class CellService {
     return GridEventUpdateCell(payload).send();
   }
 
-  Future<Either<Cell, FlowyError>> getCell({
+  Future<Either<GridCellPB, FlowyError>> getCell({
     required GridCellIdentifier cellId,
   }) {
-    final payload = CellIdentifierPayload.create()
+    final payload = GridCellIdentifierPayloadPB.create()
       ..gridId = cellId.gridId
       ..fieldId = cellId.fieldId
       ..rowId = cellId.rowId;
@@ -61,7 +61,7 @@ class GridCellIdentifier with _$GridCellIdentifier {
   const factory GridCellIdentifier({
     required String gridId,
     required String rowId,
-    required Field field,
+    required GridFieldPB field,
   }) = _GridCellIdentifier;
 
   // ignore: unused_element

+ 7 - 7
frontend/app_flowy/lib/workspace/application/grid/cell/cell_service/context_builder.dart

@@ -1,9 +1,9 @@
 part of 'cell_service.dart';
 
 typedef GridCellController = IGridCellController<String, String>;
-typedef GridSelectOptionCellController = IGridCellController<SelectOptionCellData, String>;
-typedef GridDateCellController = IGridCellController<DateCellData, CalendarData>;
-typedef GridURLCellController = IGridCellController<URLCellData, String>;
+typedef GridSelectOptionCellController = IGridCellController<SelectOptionCellDataPB, String>;
+typedef GridDateCellController = IGridCellController<DateCellDataPB, CalendarData>;
+typedef GridURLCellController = IGridCellController<URLCellDataPB, String>;
 
 class GridCellControllerBuilder {
   final GridCellIdentifier _cellId;
@@ -159,7 +159,7 @@ class IGridCellController<T, D> extends Equatable {
 
   String get fieldId => cellId.field.id;
 
-  Field get field => cellId.field;
+  GridFieldPB get field => cellId.field;
 
   FieldType get fieldType => cellId.field.fieldType;
 
@@ -223,7 +223,7 @@ class IGridCellController<T, D> extends Equatable {
     return data;
   }
 
-  /// Return the FieldTypeOptionData that can be parsed into corresponding class using the [parser].
+  /// Return the FieldTypeOptionDataPB that can be parsed into corresponding class using the [parser].
   /// [PD] is the type that the parser return.
   Future<Either<PD, FlowyError>> getFieldTypeOption<PD, P extends TypeOptionDataParser>(P parser) {
     return _fieldService.getFieldTypeOptionData(fieldType: fieldType).then((result) {
@@ -305,8 +305,8 @@ class _GridFieldChangedNotifierImpl extends GridFieldChangedNotifier {
   }
 
   @override
-  void onFieldChanged(void Function(Field p1) callback) {
-    _onChangesetFn = (GridFieldChangeset changeset) {
+  void onFieldChanged(void Function(GridFieldPB p1) callback) {
+    _onChangesetFn = (GridFieldChangesetPB changeset) {
       for (final updatedField in changeset.updatedFields) {
         callback(updatedField);
       }

+ 6 - 6
frontend/app_flowy/lib/workspace/application/grid/cell/date_cal_bloc.dart

@@ -22,7 +22,7 @@ class DateCalBloc extends Bloc<DateCalEvent, DateCalState> {
 
   DateCalBloc({
     required DateTypeOption dateTypeOption,
-    required DateCellData? cellData,
+    required DateCellDataPB? cellData,
     required this.cellContext,
   }) : super(DateCalState.initial(dateTypeOption, cellData)) {
     on<DateCalEvent>(
@@ -38,7 +38,7 @@ class DateCalBloc extends Bloc<DateCalEvent, DateCalState> {
           setFocusedDay: (focusedDay) {
             emit(state.copyWith(focusedDay: focusedDay));
           },
-          didReceiveCellUpdate: (DateCellData? cellData) {
+          didReceiveCellUpdate: (DateCellDataPB? cellData) {
             final calData = calDataFromCellData(cellData);
             final time = calData.foldRight("", (dateData, previous) => dateData.time);
             emit(state.copyWith(calData: calData, time: time));
@@ -188,7 +188,7 @@ class DateCalEvent with _$DateCalEvent {
   const factory DateCalEvent.setDateFormat(DateFormat dateFormat) = _DateFormat;
   const factory DateCalEvent.setIncludeTime(bool includeTime) = _IncludeTime;
   const factory DateCalEvent.setTime(String time) = _Time;
-  const factory DateCalEvent.didReceiveCellUpdate(DateCellData? data) = _DidReceiveCellUpdate;
+  const factory DateCalEvent.didReceiveCellUpdate(DateCellDataPB? data) = _DidReceiveCellUpdate;
   const factory DateCalEvent.didUpdateCalData(Option<CalendarData> data, Option<String> timeFormatError) =
       _DidUpdateCalData;
 }
@@ -207,7 +207,7 @@ class DateCalState with _$DateCalState {
 
   factory DateCalState.initial(
     DateTypeOption dateTypeOption,
-    DateCellData? cellData,
+    DateCellDataPB? cellData,
   ) {
     Option<CalendarData> calData = calDataFromCellData(cellData);
     final time = calData.foldRight("", (dateData, previous) => dateData.time);
@@ -233,7 +233,7 @@ String _timeHintText(DateTypeOption typeOption) {
   return "";
 }
 
-Option<CalendarData> calDataFromCellData(DateCellData? cellData) {
+Option<CalendarData> calDataFromCellData(DateCellDataPB? cellData) {
   String? time = timeFromCellData(cellData);
   Option<CalendarData> calData = none();
   if (cellData != null) {
@@ -249,7 +249,7 @@ $fixnum.Int64 timestampFromDateTime(DateTime dateTime) {
   return $fixnum.Int64(timestamp);
 }
 
-String? timeFromCellData(DateCellData? cellData) {
+String? timeFromCellData(DateCellDataPB? cellData) {
   String? time;
   if (cellData?.hasTime() ?? false) {
     time = cellData?.time;

+ 7 - 7
frontend/app_flowy/lib/workspace/application/grid/cell/date_cell_bloc.dart

@@ -15,10 +15,10 @@ class DateCellBloc extends Bloc<DateCellEvent, DateCellState> {
       (event, emit) async {
         event.when(
           initial: () => _startListening(),
-          didReceiveCellUpdate: (DateCellData? cellData) {
+          didReceiveCellUpdate: (DateCellDataPB? cellData) {
             emit(state.copyWith(data: cellData, dateStr: _dateStrFromCellData(cellData)));
           },
-          didReceiveFieldUpdate: (Field value) => emit(state.copyWith(field: value)),
+          didReceiveFieldUpdate: (GridFieldPB value) => emit(state.copyWith(field: value)),
         );
       },
     );
@@ -48,16 +48,16 @@ class DateCellBloc extends Bloc<DateCellEvent, DateCellState> {
 @freezed
 class DateCellEvent with _$DateCellEvent {
   const factory DateCellEvent.initial() = _InitialCell;
-  const factory DateCellEvent.didReceiveCellUpdate(DateCellData? data) = _DidReceiveCellUpdate;
-  const factory DateCellEvent.didReceiveFieldUpdate(Field field) = _DidReceiveFieldUpdate;
+  const factory DateCellEvent.didReceiveCellUpdate(DateCellDataPB? data) = _DidReceiveCellUpdate;
+  const factory DateCellEvent.didReceiveFieldUpdate(GridFieldPB field) = _DidReceiveFieldUpdate;
 }
 
 @freezed
 class DateCellState with _$DateCellState {
   const factory DateCellState({
-    required DateCellData? data,
+    required DateCellDataPB? data,
     required String dateStr,
-    required Field field,
+    required GridFieldPB field,
   }) = _DateCellState;
 
   factory DateCellState.initial(GridDateCellController context) {
@@ -71,7 +71,7 @@ class DateCellState with _$DateCellState {
   }
 }
 
-String _dateStrFromCellData(DateCellData? cellData) {
+String _dateStrFromCellData(DateCellDataPB? cellData) {
   String dateStr = "";
   if (cellData != null) {
     dateStr = cellData.date + " " + cellData.time;

+ 2 - 2
frontend/app_flowy/lib/workspace/application/grid/cell/select_option_cell_bloc.dart

@@ -56,14 +56,14 @@ class SelectOptionCellBloc extends Bloc<SelectOptionCellEvent, SelectOptionCellS
 class SelectOptionCellEvent with _$SelectOptionCellEvent {
   const factory SelectOptionCellEvent.initial() = _InitialCell;
   const factory SelectOptionCellEvent.didReceiveOptions(
-    List<SelectOption> selectedOptions,
+    List<SelectOptionPB> selectedOptions,
   ) = _DidReceiveOptions;
 }
 
 @freezed
 class SelectOptionCellState with _$SelectOptionCellState {
   const factory SelectOptionCellState({
-    required List<SelectOption> selectedOptions,
+    required List<SelectOptionPB> selectedOptions,
   }) = _SelectOptionCellState;
 
   factory SelectOptionCellState.initial(GridSelectOptionCellController context) {

+ 11 - 11
frontend/app_flowy/lib/workspace/application/grid/cell/select_option_editor_bloc.dart

@@ -70,7 +70,7 @@ class SelectOptionCellEditorBloc extends Bloc<SelectOptionEditorEvent, SelectOpt
     result.fold((l) => {}, (err) => Log.error(err));
   }
 
-  void _deleteOption(SelectOption option) async {
+  void _deleteOption(SelectOptionPB option) async {
     final result = await _selectOptionService.delete(
       option: option,
     );
@@ -78,7 +78,7 @@ class SelectOptionCellEditorBloc extends Bloc<SelectOptionEditorEvent, SelectOpt
     result.fold((l) => null, (err) => Log.error(err));
   }
 
-  void _updateOption(SelectOption option) async {
+  void _updateOption(SelectOptionPB option) async {
     final result = await _selectOptionService.update(
       option: option,
     );
@@ -122,8 +122,8 @@ class SelectOptionCellEditorBloc extends Bloc<SelectOptionEditorEvent, SelectOpt
     });
   }
 
-  _MakeOptionResult _makeOptions(Option<String> filter, List<SelectOption> allOptions) {
-    final List<SelectOption> options = List.from(allOptions);
+  _MakeOptionResult _makeOptions(Option<String> filter, List<SelectOptionPB> allOptions) {
+    final List<SelectOptionPB> options = List.from(allOptions);
     Option<String> createOption = filter;
 
     filter.foldRight(null, (filter, previous) {
@@ -165,20 +165,20 @@ class SelectOptionCellEditorBloc extends Bloc<SelectOptionEditorEvent, SelectOpt
 class SelectOptionEditorEvent with _$SelectOptionEditorEvent {
   const factory SelectOptionEditorEvent.initial() = _Initial;
   const factory SelectOptionEditorEvent.didReceiveOptions(
-      List<SelectOption> options, List<SelectOption> selectedOptions) = _DidReceiveOptions;
+      List<SelectOptionPB> options, List<SelectOptionPB> selectedOptions) = _DidReceiveOptions;
   const factory SelectOptionEditorEvent.newOption(String optionName) = _NewOption;
   const factory SelectOptionEditorEvent.selectOption(String optionId) = _SelectOption;
-  const factory SelectOptionEditorEvent.updateOption(SelectOption option) = _UpdateOption;
-  const factory SelectOptionEditorEvent.deleteOption(SelectOption option) = _DeleteOption;
+  const factory SelectOptionEditorEvent.updateOption(SelectOptionPB option) = _UpdateOption;
+  const factory SelectOptionEditorEvent.deleteOption(SelectOptionPB option) = _DeleteOption;
   const factory SelectOptionEditorEvent.filterOption(String optionName) = _SelectOptionFilter;
 }
 
 @freezed
 class SelectOptionEditorState with _$SelectOptionEditorState {
   const factory SelectOptionEditorState({
-    required List<SelectOption> options,
-    required List<SelectOption> allOptions,
-    required List<SelectOption> selectedOptions,
+    required List<SelectOptionPB> options,
+    required List<SelectOptionPB> allOptions,
+    required List<SelectOptionPB> selectedOptions,
     required Option<String> createOption,
     required Option<String> filter,
   }) = _SelectOptionEditorState;
@@ -196,7 +196,7 @@ class SelectOptionEditorState with _$SelectOptionEditorState {
 }
 
 class _MakeOptionResult {
-  List<SelectOption> options;
+  List<SelectOptionPB> options;
   Option<String> createOption;
 
   _MakeOptionResult({

+ 12 - 12
frontend/app_flowy/lib/workspace/application/grid/cell/select_option_service.dart

@@ -19,11 +19,11 @@ class SelectOptionService {
       (result) {
         return result.fold(
           (option) {
-            final cellIdentifier = CellIdentifierPayload.create()
+            final cellIdentifier = GridCellIdentifierPayloadPB.create()
               ..gridId = gridId
               ..fieldId = fieldId
               ..rowId = rowId;
-            final payload = SelectOptionChangesetPayload.create()
+            final payload = SelectOptionChangesetPayloadPB.create()
               ..insertOption = option
               ..cellIdentifier = cellIdentifier;
             return GridEventUpdateSelectOption(payload).send();
@@ -35,26 +35,26 @@ class SelectOptionService {
   }
 
   Future<Either<Unit, FlowyError>> update({
-    required SelectOption option,
+    required SelectOptionPB option,
   }) {
-    final payload = SelectOptionChangesetPayload.create()
+    final payload = SelectOptionChangesetPayloadPB.create()
       ..updateOption = option
       ..cellIdentifier = _cellIdentifier();
     return GridEventUpdateSelectOption(payload).send();
   }
 
   Future<Either<Unit, FlowyError>> delete({
-    required SelectOption option,
+    required SelectOptionPB option,
   }) {
-    final payload = SelectOptionChangesetPayload.create()
+    final payload = SelectOptionChangesetPayloadPB.create()
       ..deleteOption = option
       ..cellIdentifier = _cellIdentifier();
 
     return GridEventUpdateSelectOption(payload).send();
   }
 
-  Future<Either<SelectOptionCellData, FlowyError>> getOpitonContext() {
-    final payload = CellIdentifierPayload.create()
+  Future<Either<SelectOptionCellDataPB, FlowyError>> getOpitonContext() {
+    final payload = GridCellIdentifierPayloadPB.create()
       ..gridId = gridId
       ..fieldId = fieldId
       ..rowId = rowId;
@@ -63,21 +63,21 @@ class SelectOptionService {
   }
 
   Future<Either<void, FlowyError>> select({required String optionId}) {
-    final payload = SelectOptionCellChangesetPayload.create()
+    final payload = SelectOptionCellChangesetPayloadPB.create()
       ..cellIdentifier = _cellIdentifier()
       ..insertOptionId = optionId;
     return GridEventUpdateSelectOptionCell(payload).send();
   }
 
   Future<Either<void, FlowyError>> unSelect({required String optionId}) {
-    final payload = SelectOptionCellChangesetPayload.create()
+    final payload = SelectOptionCellChangesetPayloadPB.create()
       ..cellIdentifier = _cellIdentifier()
       ..deleteOptionId = optionId;
     return GridEventUpdateSelectOptionCell(payload).send();
   }
 
-  CellIdentifierPayload _cellIdentifier() {
-    return CellIdentifierPayload.create()
+  GridCellIdentifierPayloadPB _cellIdentifier() {
+    return GridCellIdentifierPayloadPB.create()
       ..gridId = gridId
       ..fieldId = fieldId
       ..rowId = rowId;

+ 1 - 1
frontend/app_flowy/lib/workspace/application/grid/cell/url_cell_bloc.dart

@@ -57,7 +57,7 @@ class URLCellBloc extends Bloc<URLCellEvent, URLCellState> {
 class URLCellEvent with _$URLCellEvent {
   const factory URLCellEvent.initial() = _InitialCell;
   const factory URLCellEvent.updateURL(String url) = _UpdateURL;
-  const factory URLCellEvent.didReceiveCellUpdate(URLCellData? cell) = _DidReceiveCellUpdate;
+  const factory URLCellEvent.didReceiveCellUpdate(URLCellDataPB? cell) = _DidReceiveCellUpdate;
 }
 
 @freezed

+ 1 - 1
frontend/app_flowy/lib/workspace/application/grid/cell/url_cell_editor_bloc.dart

@@ -54,7 +54,7 @@ class URLCellEditorBloc extends Bloc<URLCellEditorEvent, URLCellEditorState> {
 @freezed
 class URLCellEditorEvent with _$URLCellEditorEvent {
   const factory URLCellEditorEvent.initial() = _InitialCell;
-  const factory URLCellEditorEvent.didReceiveCellUpdate(URLCellData? cell) = _DidReceiveCellUpdate;
+  const factory URLCellEditorEvent.didReceiveCellUpdate(URLCellDataPB? cell) = _DidReceiveCellUpdate;
   const factory URLCellEditorEvent.updateText(String text) = _UpdateText;
 }
 

+ 4 - 4
frontend/app_flowy/lib/workspace/application/grid/field/field_action_sheet_bloc.dart

@@ -10,8 +10,8 @@ part 'field_action_sheet_bloc.freezed.dart';
 class FieldActionSheetBloc extends Bloc<FieldActionSheetEvent, FieldActionSheetState> {
   final FieldService fieldService;
 
-  FieldActionSheetBloc({required Field field, required this.fieldService})
-      : super(FieldActionSheetState.initial(FieldTypeOptionData.create()..field_2 = field)) {
+  FieldActionSheetBloc({required GridFieldPB field, required this.fieldService})
+      : super(FieldActionSheetState.initial(FieldTypeOptionDataPB.create()..field_2 = field)) {
     on<FieldActionSheetEvent>(
       (event, emit) async {
         await event.map(
@@ -67,12 +67,12 @@ class FieldActionSheetEvent with _$FieldActionSheetEvent {
 @freezed
 class FieldActionSheetState with _$FieldActionSheetState {
   const factory FieldActionSheetState({
-    required FieldTypeOptionData fieldTypeOptionData,
+    required FieldTypeOptionDataPB fieldTypeOptionData,
     required String errorText,
     required String fieldName,
   }) = _FieldActionSheetState;
 
-  factory FieldActionSheetState.initial(FieldTypeOptionData data) => FieldActionSheetState(
+  factory FieldActionSheetState.initial(FieldTypeOptionDataPB data) => FieldActionSheetState(
         fieldTypeOptionData: data,
         errorText: '',
         fieldName: data.field_2.name,

+ 2 - 2
frontend/app_flowy/lib/workspace/application/grid/field/field_cell_bloc.dart

@@ -62,7 +62,7 @@ class FieldCellBloc extends Bloc<FieldCellEvent, FieldCellState> {
 @freezed
 class FieldCellEvent with _$FieldCellEvent {
   const factory FieldCellEvent.initial() = _InitialCell;
-  const factory FieldCellEvent.didReceiveFieldUpdate(Field field) = _DidReceiveFieldUpdate;
+  const factory FieldCellEvent.didReceiveFieldUpdate(GridFieldPB field) = _DidReceiveFieldUpdate;
   const factory FieldCellEvent.startUpdateWidth(double offset) = _StartUpdateWidth;
   const factory FieldCellEvent.endUpdateWidth() = _EndUpdateWidth;
 }
@@ -71,7 +71,7 @@ class FieldCellEvent with _$FieldCellEvent {
 class FieldCellState with _$FieldCellState {
   const factory FieldCellState({
     required String gridId,
-    required Field field,
+    required GridFieldPB field,
     required double width,
   }) = _FieldCellState;
 

+ 3 - 3
frontend/app_flowy/lib/workspace/application/grid/field/field_editor_bloc.dart

@@ -30,7 +30,7 @@ class FieldEditorBloc extends Bloc<FieldEditorEvent, FieldEditorState> {
             dataController.fieldName = name;
             emit(state.copyWith(name: name));
           },
-          didReceiveFieldChanged: (Field field) {
+          didReceiveFieldChanged: (GridFieldPB field) {
             emit(state.copyWith(field: Some(field)));
           },
         );
@@ -48,7 +48,7 @@ class FieldEditorBloc extends Bloc<FieldEditorEvent, FieldEditorState> {
 class FieldEditorEvent with _$FieldEditorEvent {
   const factory FieldEditorEvent.initial() = _InitialField;
   const factory FieldEditorEvent.updateName(String name) = _UpdateName;
-  const factory FieldEditorEvent.didReceiveFieldChanged(Field field) = _DidReceiveFieldChanged;
+  const factory FieldEditorEvent.didReceiveFieldChanged(GridFieldPB field) = _DidReceiveFieldChanged;
 }
 
 @freezed
@@ -57,7 +57,7 @@ class FieldEditorState with _$FieldEditorState {
     required String gridId,
     required String errorText,
     required String name,
-    required Option<Field> field,
+    required Option<GridFieldPB> field,
   }) = _FieldEditorState;
 
   factory FieldEditorState.initial(

+ 2 - 2
frontend/app_flowy/lib/workspace/application/grid/field/field_listener.dart

@@ -7,7 +7,7 @@ import 'dart:async';
 import 'dart:typed_data';
 import 'package:flowy_sdk/protobuf/flowy-grid/field_entities.pb.dart';
 
-typedef UpdateFieldNotifiedValue = Either<Field, FlowyError>;
+typedef UpdateFieldNotifiedValue = Either<GridFieldPB, FlowyError>;
 
 class SingleFieldListener {
   final String fieldId;
@@ -31,7 +31,7 @@ class SingleFieldListener {
     switch (ty) {
       case GridNotification.DidUpdateField:
         result.fold(
-          (payload) => _updateFieldNotifier?.value = left(Field.fromBuffer(payload)),
+          (payload) => _updateFieldNotifier?.value = left(GridFieldPB.fromBuffer(payload)),
           (error) => _updateFieldNotifier?.value = right(error),
         );
         break;

+ 23 - 23
frontend/app_flowy/lib/workspace/application/grid/field/field_service.dart

@@ -39,7 +39,7 @@ class FieldService {
     double? width,
     List<int>? typeOptionData,
   }) {
-    var payload = FieldChangesetPayload.create()
+    var payload = FieldChangesetPayloadPB.create()
       ..gridId = gridId
       ..fieldId = fieldId;
 
@@ -73,11 +73,11 @@ class FieldService {
   // Create the field if it does not exist. Otherwise, update the field.
   static Future<Either<Unit, FlowyError>> insertField({
     required String gridId,
-    required Field field,
+    required GridFieldPB field,
     List<int>? typeOptionData,
     String? startFieldId,
   }) {
-    var payload = InsertFieldPayload.create()
+    var payload = InsertFieldPayloadPB.create()
       ..gridId = gridId
       ..field_2 = field
       ..typeOptionData = typeOptionData ?? [];
@@ -94,7 +94,7 @@ class FieldService {
     required String fieldId,
     required List<int> typeOptionData,
   }) {
-    var payload = UpdateFieldTypeOptionPayload.create()
+    var payload = UpdateFieldTypeOptionPayloadPB.create()
       ..gridId = gridId
       ..fieldId = fieldId
       ..typeOptionData = typeOptionData;
@@ -103,7 +103,7 @@ class FieldService {
   }
 
   Future<Either<Unit, FlowyError>> deleteField() {
-    final payload = FieldIdentifierPayload.create()
+    final payload = GridFieldIdentifierPayloadPB.create()
       ..gridId = gridId
       ..fieldId = fieldId;
 
@@ -111,17 +111,17 @@ class FieldService {
   }
 
   Future<Either<Unit, FlowyError>> duplicateField() {
-    final payload = FieldIdentifierPayload.create()
+    final payload = GridFieldIdentifierPayloadPB.create()
       ..gridId = gridId
       ..fieldId = fieldId;
 
     return GridEventDuplicateField(payload).send();
   }
 
-  Future<Either<FieldTypeOptionData, FlowyError>> getFieldTypeOptionData({
+  Future<Either<FieldTypeOptionDataPB, FlowyError>> getFieldTypeOptionData({
     required FieldType fieldType,
   }) {
-    final payload = EditFieldPayload.create()
+    final payload = EditFieldPayloadPB.create()
       ..gridId = gridId
       ..fieldId = fieldId
       ..fieldType = fieldType;
@@ -138,16 +138,16 @@ class FieldService {
 class GridFieldCellContext with _$GridFieldCellContext {
   const factory GridFieldCellContext({
     required String gridId,
-    required Field field,
+    required GridFieldPB field,
   }) = _GridFieldCellContext;
 }
 
 abstract class IFieldTypeOptionLoader {
   String get gridId;
-  Future<Either<FieldTypeOptionData, FlowyError>> load();
+  Future<Either<FieldTypeOptionDataPB, FlowyError>> load();
 
-  Future<Either<FieldTypeOptionData, FlowyError>> switchToField(String fieldId, FieldType fieldType) {
-    final payload = EditFieldPayload.create()
+  Future<Either<FieldTypeOptionDataPB, FlowyError>> switchToField(String fieldId, FieldType fieldType) {
+    final payload = EditFieldPayloadPB.create()
       ..gridId = gridId
       ..fieldId = fieldId
       ..fieldType = fieldType;
@@ -164,8 +164,8 @@ class NewFieldTypeOptionLoader extends IFieldTypeOptionLoader {
   });
 
   @override
-  Future<Either<FieldTypeOptionData, FlowyError>> load() {
-    final payload = EditFieldPayload.create()
+  Future<Either<FieldTypeOptionDataPB, FlowyError>> load() {
+    final payload = EditFieldPayloadPB.create()
       ..gridId = gridId
       ..fieldType = FieldType.RichText;
 
@@ -176,7 +176,7 @@ class NewFieldTypeOptionLoader extends IFieldTypeOptionLoader {
 class FieldTypeOptionLoader extends IFieldTypeOptionLoader {
   @override
   final String gridId;
-  final Field field;
+  final GridFieldPB field;
 
   FieldTypeOptionLoader({
     required this.gridId,
@@ -184,8 +184,8 @@ class FieldTypeOptionLoader extends IFieldTypeOptionLoader {
   });
 
   @override
-  Future<Either<FieldTypeOptionData, FlowyError>> load() {
-    final payload = EditFieldPayload.create()
+  Future<Either<FieldTypeOptionDataPB, FlowyError>> load() {
+    final payload = EditFieldPayloadPB.create()
       ..gridId = gridId
       ..fieldId = field.id
       ..fieldType = field.fieldType;
@@ -198,8 +198,8 @@ class TypeOptionDataController {
   final String gridId;
   final IFieldTypeOptionLoader _loader;
 
-  late FieldTypeOptionData _data;
-  final PublishNotifier<Field> _fieldNotifier = PublishNotifier();
+  late FieldTypeOptionDataPB _data;
+  final PublishNotifier<GridFieldPB> _fieldNotifier = PublishNotifier();
 
   TypeOptionDataController({
     required this.gridId,
@@ -222,9 +222,9 @@ class TypeOptionDataController {
     );
   }
 
-  Field get field => _data.field_2;
+  GridFieldPB get field => _data.field_2;
 
-  set field(Field field) {
+  set field(GridFieldPB field) {
     _updateData(newField: field);
   }
 
@@ -238,7 +238,7 @@ class TypeOptionDataController {
     _updateData(newTypeOptionData: typeOptionData);
   }
 
-  void _updateData({String? newName, Field? newField, List<int>? newTypeOptionData}) {
+  void _updateData({String? newName, GridFieldPB? newField, List<int>? newTypeOptionData}) {
     _data = _data.rebuild((rebuildData) {
       if (newName != null) {
         rebuildData.field_2 = rebuildData.field_2.rebuild((rebuildField) {
@@ -280,7 +280,7 @@ class TypeOptionDataController {
     });
   }
 
-  void Function() addFieldListener(void Function(Field) callback) {
+  void Function() addFieldListener(void Function(GridFieldPB) callback) {
     listener() {
       callback(field);
     }

+ 2 - 2
frontend/app_flowy/lib/workspace/application/grid/field/field_type_option_edit_bloc.dart

@@ -42,13 +42,13 @@ class FieldTypeOptionEditBloc extends Bloc<FieldTypeOptionEditEvent, FieldTypeOp
 @freezed
 class FieldTypeOptionEditEvent with _$FieldTypeOptionEditEvent {
   const factory FieldTypeOptionEditEvent.initial() = _Initial;
-  const factory FieldTypeOptionEditEvent.didReceiveFieldUpdated(Field field) = _DidReceiveFieldUpdated;
+  const factory FieldTypeOptionEditEvent.didReceiveFieldUpdated(GridFieldPB field) = _DidReceiveFieldUpdated;
 }
 
 @freezed
 class FieldTypeOptionEditState with _$FieldTypeOptionEditState {
   const factory FieldTypeOptionEditState({
-    required Field field,
+    required GridFieldPB field,
   }) = _FieldTypeOptionEditState;
 
   factory FieldTypeOptionEditState.initial(TypeOptionDataController fieldContext) => FieldTypeOptionEditState(

+ 2 - 2
frontend/app_flowy/lib/workspace/application/grid/field/grid_listenr.dart

@@ -7,7 +7,7 @@ import 'dart:async';
 import 'dart:typed_data';
 import 'package:flowy_sdk/protobuf/flowy-grid/field_entities.pb.dart';
 
-typedef UpdateFieldNotifiedValue = Either<GridFieldChangeset, FlowyError>;
+typedef UpdateFieldNotifiedValue = Either<GridFieldChangesetPB, FlowyError>;
 
 class GridFieldsListener {
   final String gridId;
@@ -27,7 +27,7 @@ class GridFieldsListener {
     switch (ty) {
       case GridNotification.DidUpdateGridField:
         result.fold(
-          (payload) => updateFieldsNotifier?.value = left(GridFieldChangeset.fromBuffer(payload)),
+          (payload) => updateFieldsNotifier?.value = left(GridFieldChangesetPB.fromBuffer(payload)),
           (error) => updateFieldsNotifier?.value = right(error),
         );
         break;

+ 6 - 6
frontend/app_flowy/lib/workspace/application/grid/field/type_option/edit_select_option_bloc.dart

@@ -7,7 +7,7 @@ import 'package:dartz/dartz.dart';
 part 'edit_select_option_bloc.freezed.dart';
 
 class EditSelectOptionBloc extends Bloc<EditSelectOptionEvent, EditSelectOptionState> {
-  EditSelectOptionBloc({required SelectOption option}) : super(EditSelectOptionState.initial(option)) {
+  EditSelectOptionBloc({required SelectOptionPB option}) : super(EditSelectOptionState.initial(option)) {
     on<EditSelectOptionEvent>(
       (event, emit) async {
         event.map(
@@ -30,14 +30,14 @@ class EditSelectOptionBloc extends Bloc<EditSelectOptionEvent, EditSelectOptionS
     return super.close();
   }
 
-  SelectOption _updateColor(SelectOptionColor color) {
+  SelectOptionPB _updateColor(SelectOptionColorPB color) {
     state.option.freeze();
     return state.option.rebuild((option) {
       option.color = color;
     });
   }
 
-  SelectOption _updateName(String name) {
+  SelectOptionPB _updateName(String name) {
     state.option.freeze();
     return state.option.rebuild((option) {
       option.name = name;
@@ -48,18 +48,18 @@ class EditSelectOptionBloc extends Bloc<EditSelectOptionEvent, EditSelectOptionS
 @freezed
 class EditSelectOptionEvent with _$EditSelectOptionEvent {
   const factory EditSelectOptionEvent.updateName(String name) = _UpdateName;
-  const factory EditSelectOptionEvent.updateColor(SelectOptionColor color) = _UpdateColor;
+  const factory EditSelectOptionEvent.updateColor(SelectOptionColorPB color) = _UpdateColor;
   const factory EditSelectOptionEvent.delete() = _Delete;
 }
 
 @freezed
 class EditSelectOptionState with _$EditSelectOptionState {
   const factory EditSelectOptionState({
-    required SelectOption option,
+    required SelectOptionPB option,
     required Option<bool> deleted,
   }) = _EditSelectOptionState;
 
-  factory EditSelectOptionState.initial(SelectOption option) => EditSelectOptionState(
+  factory EditSelectOptionState.initial(SelectOptionPB option) => EditSelectOptionState(
         option: option,
         deleted: none(),
       );

+ 5 - 5
frontend/app_flowy/lib/workspace/application/grid/field/type_option/multi_select_type_option.dart

@@ -21,8 +21,8 @@ class MultiSelectTypeOptionContext extends TypeOptionWidgetContext<MultiSelectTy
         super(dataParser: dataBuilder, dataController: dataController);
 
   @override
-  List<SelectOption> Function(SelectOption) get deleteOption {
-    return (SelectOption option) {
+  List<SelectOptionPB> Function(SelectOptionPB) get deleteOption {
+    return (SelectOptionPB option) {
       typeOption.freeze();
       typeOption = typeOption.rebuild((typeOption) {
         final index = typeOption.options.indexWhere((element) => element.id == option.id);
@@ -35,7 +35,7 @@ class MultiSelectTypeOptionContext extends TypeOptionWidgetContext<MultiSelectTy
   }
 
   @override
-  Future<List<SelectOption>> Function(String) get insertOption {
+  Future<List<SelectOptionPB>> Function(String) get insertOption {
     return (String optionName) {
       return service.newOption(name: optionName).then((result) {
         return result.fold(
@@ -57,8 +57,8 @@ class MultiSelectTypeOptionContext extends TypeOptionWidgetContext<MultiSelectTy
   }
 
   @override
-  List<SelectOption> Function(SelectOption) get udpateOption {
-    return (SelectOption option) {
+  List<SelectOptionPB> Function(SelectOptionPB) get udpateOption {
+    return (SelectOptionPB option) {
       typeOption.freeze();
       typeOption = typeOption.rebuild((typeOption) {
         final index = typeOption.options.indexWhere((element) => element.id == option.id);

+ 11 - 11
frontend/app_flowy/lib/workspace/application/grid/field/type_option/select_option_type_option_bloc.dart

@@ -6,25 +6,25 @@ import 'package:dartz/dartz.dart';
 part 'select_option_type_option_bloc.freezed.dart';
 
 abstract class SelectOptionTypeOptionAction {
-  Future<List<SelectOption>> Function(String) get insertOption;
+  Future<List<SelectOptionPB>> Function(String) get insertOption;
 
-  List<SelectOption> Function(SelectOption) get deleteOption;
+  List<SelectOptionPB> Function(SelectOptionPB) get deleteOption;
 
-  List<SelectOption> Function(SelectOption) get udpateOption;
+  List<SelectOptionPB> Function(SelectOptionPB) get udpateOption;
 }
 
 class SelectOptionTypeOptionBloc extends Bloc<SelectOptionTypeOptionEvent, SelectOptionTypeOptionState> {
   final SelectOptionTypeOptionAction typeOptionAction;
 
   SelectOptionTypeOptionBloc({
-    required List<SelectOption> options,
+    required List<SelectOptionPB> options,
     required this.typeOptionAction,
   }) : super(SelectOptionTypeOptionState.initial(options)) {
     on<SelectOptionTypeOptionEvent>(
       (event, emit) async {
         await event.when(
           createOption: (optionName) async {
-            final List<SelectOption> options = await typeOptionAction.insertOption(optionName);
+            final List<SelectOptionPB> options = await typeOptionAction.insertOption(optionName);
             emit(state.copyWith(options: options));
           },
           addingOption: () {
@@ -34,11 +34,11 @@ class SelectOptionTypeOptionBloc extends Bloc<SelectOptionTypeOptionEvent, Selec
             emit(state.copyWith(isEditingOption: false, newOptionName: none()));
           },
           updateOption: (option) {
-            final List<SelectOption> options = typeOptionAction.udpateOption(option);
+            final List<SelectOptionPB> options = typeOptionAction.udpateOption(option);
             emit(state.copyWith(options: options));
           },
           deleteOption: (option) {
-            final List<SelectOption> options = typeOptionAction.deleteOption(option);
+            final List<SelectOptionPB> options = typeOptionAction.deleteOption(option);
             emit(state.copyWith(options: options));
           },
         );
@@ -57,19 +57,19 @@ class SelectOptionTypeOptionEvent with _$SelectOptionTypeOptionEvent {
   const factory SelectOptionTypeOptionEvent.createOption(String optionName) = _CreateOption;
   const factory SelectOptionTypeOptionEvent.addingOption() = _AddingOption;
   const factory SelectOptionTypeOptionEvent.endAddingOption() = _EndAddingOption;
-  const factory SelectOptionTypeOptionEvent.updateOption(SelectOption option) = _UpdateOption;
-  const factory SelectOptionTypeOptionEvent.deleteOption(SelectOption option) = _DeleteOption;
+  const factory SelectOptionTypeOptionEvent.updateOption(SelectOptionPB option) = _UpdateOption;
+  const factory SelectOptionTypeOptionEvent.deleteOption(SelectOptionPB option) = _DeleteOption;
 }
 
 @freezed
 class SelectOptionTypeOptionState with _$SelectOptionTypeOptionState {
   const factory SelectOptionTypeOptionState({
-    required List<SelectOption> options,
+    required List<SelectOptionPB> options,
     required bool isEditingOption,
     required Option<String> newOptionName,
   }) = _SelectOptionTyepOptionState;
 
-  factory SelectOptionTypeOptionState.initial(List<SelectOption> options) => SelectOptionTypeOptionState(
+  factory SelectOptionTypeOptionState.initial(List<SelectOptionPB> options) => SelectOptionTypeOptionState(
         options: options,
         isEditingOption: false,
         newOptionName: none(),

+ 9 - 9
frontend/app_flowy/lib/workspace/application/grid/field/type_option/single_select_type_option.dart

@@ -7,7 +7,7 @@ import 'package:protobuf/protobuf.dart';
 import 'select_option_type_option_bloc.dart';
 import 'type_option_service.dart';
 
-class SingleSelectTypeOptionContext extends TypeOptionWidgetContext<SingleSelectTypeOption>
+class SingleSelectTypeOptionContext extends TypeOptionWidgetContext<SingleSelectTypeOptionPB>
     with SelectOptionTypeOptionAction {
   final TypeOptionService service;
 
@@ -21,8 +21,8 @@ class SingleSelectTypeOptionContext extends TypeOptionWidgetContext<SingleSelect
         super(dataParser: dataBuilder, dataController: fieldContext);
 
   @override
-  List<SelectOption> Function(SelectOption) get deleteOption {
-    return (SelectOption option) {
+  List<SelectOptionPB> Function(SelectOptionPB) get deleteOption {
+    return (SelectOptionPB option) {
       typeOption.freeze();
       typeOption = typeOption.rebuild((typeOption) {
         final index = typeOption.options.indexWhere((element) => element.id == option.id);
@@ -35,7 +35,7 @@ class SingleSelectTypeOptionContext extends TypeOptionWidgetContext<SingleSelect
   }
 
   @override
-  Future<List<SelectOption>> Function(String) get insertOption {
+  Future<List<SelectOptionPB>> Function(String) get insertOption {
     return (String optionName) {
       return service.newOption(name: optionName).then((result) {
         return result.fold(
@@ -57,8 +57,8 @@ class SingleSelectTypeOptionContext extends TypeOptionWidgetContext<SingleSelect
   }
 
   @override
-  List<SelectOption> Function(SelectOption) get udpateOption {
-    return (SelectOption option) {
+  List<SelectOptionPB> Function(SelectOptionPB) get udpateOption {
+    return (SelectOptionPB option) {
       typeOption.freeze();
       typeOption = typeOption.rebuild((typeOption) {
         final index = typeOption.options.indexWhere((element) => element.id == option.id);
@@ -71,9 +71,9 @@ class SingleSelectTypeOptionContext extends TypeOptionWidgetContext<SingleSelect
   }
 }
 
-class SingleSelectTypeOptionWidgetDataParser extends TypeOptionDataParser<SingleSelectTypeOption> {
+class SingleSelectTypeOptionWidgetDataParser extends TypeOptionDataParser<SingleSelectTypeOptionPB> {
   @override
-  SingleSelectTypeOption fromBuffer(List<int> buffer) {
-    return SingleSelectTypeOption.fromBuffer(buffer);
+  SingleSelectTypeOptionPB fromBuffer(List<int> buffer) {
+    return SingleSelectTypeOptionPB.fromBuffer(buffer);
   }
 }

+ 5 - 5
frontend/app_flowy/lib/workspace/application/grid/field/type_option/type_option_service.dart

@@ -18,14 +18,14 @@ class TypeOptionService {
     required this.fieldId,
   });
 
-  Future<Either<SelectOption, FlowyError>> newOption({
+  Future<Either<SelectOptionPB, FlowyError>> newOption({
     required String name,
   }) {
-    final fieldIdentifier = FieldIdentifierPayload.create()
+    final fieldIdentifier = GridFieldIdentifierPayloadPB.create()
       ..gridId = gridId
       ..fieldId = fieldId;
 
-    final payload = CreateSelectOptionPayload.create()
+    final payload = CreateSelectOptionPayloadPB.create()
       ..optionName = name
       ..fieldIdentifier = fieldIdentifier;
 
@@ -49,7 +49,7 @@ class TypeOptionWidgetContext<T extends GeneratedMessage> {
 
   String get gridId => _dataController.gridId;
 
-  Field get field => _dataController.field;
+  GridFieldPB get field => _dataController.field;
 
   T get typeOption {
     if (_typeOptionObject != null) {
@@ -74,7 +74,7 @@ abstract class TypeOptionFieldDelegate {
 
 class TypeOptionContext2<T> {
   final String gridId;
-  final Field field;
+  final GridFieldPB field;
   final FieldService _fieldService;
   T? _data;
   final TypeOptionDataParser dataBuilder;

+ 8 - 8
frontend/app_flowy/lib/workspace/application/grid/grid_bloc.dart

@@ -93,8 +93,8 @@ class GridBloc extends Bloc<GridEvent, GridState> {
     );
   }
 
-  Future<void> _loadFields(Grid grid, Emitter<GridState> emit) async {
-    final result = await _gridService.getFields(fieldOrders: grid.fields);
+  Future<void> _loadFields(GridPB grid, Emitter<GridState> emit) async {
+    final result = await _gridService.getFields(fieldIds: grid.fields);
     return Future(
       () => result.fold(
         (fields) {
@@ -112,7 +112,7 @@ class GridBloc extends Bloc<GridEvent, GridState> {
     );
   }
 
-  void _initialBlocks(List<GridBlock> blocks) {
+  void _initialBlocks(List<GridBlockPB> blocks) {
     for (final block in blocks) {
       if (_blocks[block.id] != null) {
         Log.warn("Intial duplicate block's cache: ${block.id}");
@@ -141,14 +141,14 @@ class GridEvent with _$GridEvent {
   const factory GridEvent.createRow() = _CreateRow;
   const factory GridEvent.didReceiveRowUpdate(List<GridRowInfo> rows, GridRowChangeReason listState) =
       _DidReceiveRowUpdate;
-  const factory GridEvent.didReceiveFieldUpdate(List<Field> fields) = _DidReceiveFieldUpdate;
+  const factory GridEvent.didReceiveFieldUpdate(List<GridFieldPB> fields) = _DidReceiveFieldUpdate;
 }
 
 @freezed
 class GridState with _$GridState {
   const factory GridState({
     required String gridId,
-    required Option<Grid> grid,
+    required Option<GridPB> grid,
     required GridFieldEquatable fields,
     required List<GridRowInfo> rowInfos,
     required GridLoadingState loadingState,
@@ -172,8 +172,8 @@ class GridLoadingState with _$GridLoadingState {
 }
 
 class GridFieldEquatable extends Equatable {
-  final List<Field> _fields;
-  const GridFieldEquatable(List<Field> fields) : _fields = fields;
+  final List<GridFieldPB> _fields;
+  const GridFieldEquatable(List<GridFieldPB> fields) : _fields = fields;
 
   @override
   List<Object?> get props {
@@ -183,5 +183,5 @@ class GridFieldEquatable extends Equatable {
     ];
   }
 
-  UnmodifiableListView<Field> get value => UnmodifiableListView(_fields);
+  UnmodifiableListView<GridFieldPB> get value => UnmodifiableListView(_fields);
 }

+ 6 - 6
frontend/app_flowy/lib/workspace/application/grid/grid_header_bloc.dart

@@ -34,7 +34,7 @@ class GridHeaderBloc extends Bloc<GridHeaderEvent, GridHeaderState> {
   }
 
   Future<void> _moveField(_MoveField value, Emitter<GridHeaderState> emit) async {
-    final fields = List<Field>.from(state.fields);
+    final fields = List<GridFieldPB>.from(state.fields);
     fields.insert(value.toIndex, fields.removeAt(value.fromIndex));
     emit(state.copyWith(fields: fields));
 
@@ -62,16 +62,16 @@ class GridHeaderBloc extends Bloc<GridHeaderEvent, GridHeaderState> {
 @freezed
 class GridHeaderEvent with _$GridHeaderEvent {
   const factory GridHeaderEvent.initial() = _InitialHeader;
-  const factory GridHeaderEvent.didReceiveFieldUpdate(List<Field> fields) = _DidReceiveFieldUpdate;
-  const factory GridHeaderEvent.moveField(Field field, int fromIndex, int toIndex) = _MoveField;
+  const factory GridHeaderEvent.didReceiveFieldUpdate(List<GridFieldPB> fields) = _DidReceiveFieldUpdate;
+  const factory GridHeaderEvent.moveField(GridFieldPB field, int fromIndex, int toIndex) = _MoveField;
 }
 
 @freezed
 class GridHeaderState with _$GridHeaderState {
-  const factory GridHeaderState({required List<Field> fields}) = _GridHeaderState;
+  const factory GridHeaderState({required List<GridFieldPB> fields}) = _GridHeaderState;
 
-  factory GridHeaderState.initial(List<Field> fields) {
-    // final List<Field> newFields = List.from(fields);
+  factory GridHeaderState.initial(List<GridFieldPB> fields) {
+    // final List<GridFieldPB> newFields = List.from(fields);
     // newFields.retainWhere((field) => field.visibility);
     return GridHeaderState(fields: fields);
   }

+ 23 - 23
frontend/app_flowy/lib/workspace/application/grid/grid_service.dart

@@ -26,16 +26,16 @@ class GridService {
     return GridEventGetGrid(payload).send();
   }
 
-  Future<Either<Row, FlowyError>> createRow({Option<String>? startRowId}) {
-    CreateRowPayload payload = CreateRowPayload.create()..gridId = gridId;
+  Future<Either<GridRowPB, FlowyError>> createRow({Option<String>? startRowId}) {
+    CreateRowPayloadPB payload = CreateRowPayloadPB.create()..gridId = gridId;
     startRowId?.fold(() => null, (id) => payload.startRowId = id);
     return GridEventCreateRow(payload).send();
   }
 
-  Future<Either<RepeatedField, FlowyError>> getFields({required List<GridFieldPB> fieldOrders}) {
-    final payload = QueryFieldPayload.create()
+  Future<Either<RepeatedGridFieldPB, FlowyError>> getFields({required List<GridFieldIdPB> fieldIds}) {
+    final payload = QueryFieldPayloadPB.create()
       ..gridId = gridId
-      ..fieldOrders = RepeatedFieldOrder(items: fieldOrders);
+      ..fieldIds = RepeatedGridFieldIdPB(items: fieldIds);
     return GridEventGetFields(payload).send();
   }
 
@@ -46,18 +46,18 @@ class GridService {
 }
 
 class FieldsNotifier extends ChangeNotifier {
-  List<Field> _fields = [];
+  List<GridFieldPB> _fields = [];
 
-  set fields(List<Field> fields) {
+  set fields(List<GridFieldPB> fields) {
     _fields = fields;
     notifyListeners();
   }
 
-  List<Field> get fields => _fields;
+  List<GridFieldPB> get fields => _fields;
 }
 
-typedef FieldChangesetCallback = void Function(GridFieldChangeset);
-typedef FieldsCallback = void Function(List<Field>);
+typedef FieldChangesetCallback = void Function(GridFieldChangesetPB);
+typedef FieldsCallback = void Function(List<GridFieldPB>);
 
 class GridFieldCache {
   final String gridId;
@@ -88,11 +88,11 @@ class GridFieldCache {
     _fieldNotifier = null;
   }
 
-  UnmodifiableListView<Field> get unmodifiableFields => UnmodifiableListView(_fieldNotifier?.fields ?? []);
+  UnmodifiableListView<GridFieldPB> get unmodifiableFields => UnmodifiableListView(_fieldNotifier?.fields ?? []);
 
-  List<Field> get fields => [..._fieldNotifier?.fields ?? []];
+  List<GridFieldPB> get fields => [..._fieldNotifier?.fields ?? []];
 
-  set fields(List<Field> fields) {
+  set fields(List<GridFieldPB> fields) {
     _fieldNotifier?.fields = [...fields];
   }
 
@@ -141,12 +141,12 @@ class GridFieldCache {
     }
   }
 
-  void _deleteFields(List<GridFieldPB> deletedFields) {
+  void _deleteFields(List<GridFieldIdPB> deletedFields) {
     if (deletedFields.isEmpty) {
       return;
     }
-    final List<Field> newFields = fields;
-    final Map<String, GridFieldPB> deletedFieldMap = {
+    final List<GridFieldPB> newFields = fields;
+    final Map<String, GridFieldIdPB> deletedFieldMap = {
       for (var fieldOrder in deletedFields) fieldOrder.fieldId: fieldOrder
     };
 
@@ -154,11 +154,11 @@ class GridFieldCache {
     _fieldNotifier?.fields = newFields;
   }
 
-  void _insertFields(List<IndexField> insertedFields) {
+  void _insertFields(List<IndexFieldPB> insertedFields) {
     if (insertedFields.isEmpty) {
       return;
     }
-    final List<Field> newFields = fields;
+    final List<GridFieldPB> newFields = fields;
     for (final indexField in insertedFields) {
       if (newFields.length > indexField.index) {
         newFields.insert(indexField.index, indexField.field_1);
@@ -169,11 +169,11 @@ class GridFieldCache {
     _fieldNotifier?.fields = newFields;
   }
 
-  void _updateFields(List<Field> updatedFields) {
+  void _updateFields(List<GridFieldPB> updatedFields) {
     if (updatedFields.isEmpty) {
       return;
     }
-    final List<Field> newFields = fields;
+    final List<GridFieldPB> newFields = fields;
     for (final updatedField in updatedFields) {
       final index = newFields.indexWhere((field) => field.id == updatedField.id);
       if (index != -1) {
@@ -192,7 +192,7 @@ class GridRowCacheFieldNotifierImpl extends GridRowCacheFieldNotifier {
   GridRowCacheFieldNotifierImpl(GridFieldCache cache) : _cache = cache;
 
   @override
-  UnmodifiableListView<Field> get fields => _cache.unmodifiableFields;
+  UnmodifiableListView<GridFieldPB> get fields => _cache.unmodifiableFields;
 
   @override
   void onFieldsChanged(VoidCallback callback) {
@@ -201,8 +201,8 @@ class GridRowCacheFieldNotifierImpl extends GridRowCacheFieldNotifier {
   }
 
   @override
-  void onFieldChanged(void Function(Field) callback) {
-    _onChangesetFn = (GridFieldChangeset changeset) {
+  void onFieldChanged(void Function(GridFieldPB) callback) {
+    _onChangesetFn = (GridFieldChangesetPB changeset) {
       for (final updatedField in changeset.updatedFields) {
         callback(updatedField);
       }

+ 3 - 3
frontend/app_flowy/lib/workspace/application/grid/prelude.dart

@@ -4,18 +4,18 @@ export 'row/row_service.dart';
 export 'grid_service.dart';
 export 'grid_header_bloc.dart';
 
-// Field
+// GridFieldPB
 export 'field/field_service.dart';
 export 'field/field_action_sheet_bloc.dart';
 export 'field/field_editor_bloc.dart';
 export 'field/field_type_option_edit_bloc.dart';
 
-// Field Type Option
+// GridFieldPB Type Option
 export 'field/type_option/date_bloc.dart';
 export 'field/type_option/number_bloc.dart';
 export 'field/type_option/single_select_type_option.dart';
 
-// Cell
+// GridCellPB
 export 'cell/text_cell_bloc.dart';
 export 'cell/number_cell_bloc.dart';
 export 'cell/select_option_cell_bloc.dart';

+ 2 - 2
frontend/app_flowy/lib/workspace/application/grid/row/row_bloc.dart

@@ -90,9 +90,9 @@ class RowState with _$RowState {
 }
 
 class GridCellEquatable extends Equatable {
-  final Field _field;
+  final GridFieldPB _field;
 
-  const GridCellEquatable(Field field) : _field = field;
+  const GridCellEquatable(GridFieldPB field) : _field = field;
 
   @override
   List<Object?> get props => [

+ 3 - 3
frontend/app_flowy/lib/workspace/application/grid/row/row_listener.dart

@@ -8,8 +8,8 @@ import 'dart:typed_data';
 import 'package:dartz/dartz.dart';
 import 'package:flowy_sdk/protobuf/flowy-grid/field_entities.pb.dart';
 
-typedef UpdateRowNotifiedValue = Either<Row, FlowyError>;
-typedef UpdateFieldNotifiedValue = Either<List<Field>, FlowyError>;
+typedef UpdateRowNotifiedValue = Either<GridRowPB, FlowyError>;
+typedef UpdateFieldNotifiedValue = Either<List<GridFieldPB>, FlowyError>;
 
 class RowListener {
   final String rowId;
@@ -26,7 +26,7 @@ class RowListener {
     switch (ty) {
       case GridNotification.DidUpdateRow:
         result.fold(
-          (payload) => updateRowNotifier?.value = left(Row.fromBuffer(payload)),
+          (payload) => updateRowNotifier?.value = left(GridRowPB.fromBuffer(payload)),
           (error) => updateRowNotifier?.value = right(error),
         );
         break;

+ 21 - 21
frontend/app_flowy/lib/workspace/application/grid/row/row_service.dart

@@ -15,9 +15,9 @@ part 'row_service.freezed.dart';
 typedef RowUpdateCallback = void Function();
 
 abstract class GridRowCacheFieldNotifier {
-  UnmodifiableListView<Field> get fields;
+  UnmodifiableListView<GridFieldPB> get fields;
   void onFieldsChanged(VoidCallback callback);
-  void onFieldChanged(void Function(Field) callback);
+  void onFieldChanged(void Function(GridFieldPB) callback);
   void dispose();
 }
 
@@ -28,14 +28,14 @@ abstract class GridRowCacheFieldNotifier {
 
 class GridRowCache {
   final String gridId;
-  final GridBlock block;
+  final GridBlockPB block;
 
   /// _rows containers the current block's rows
   /// Use List to reverse the order of the GridRow.
   List<GridRowInfo> _rowInfos = [];
 
   /// Use Map for faster access the raw row data.
-  final HashMap<String, Row> _rowByRowId;
+  final HashMap<String, GridRowPB> _rowByRowId;
 
   final GridCellCache _cellCache;
   final GridRowCacheFieldNotifier _fieldNotifier;
@@ -64,7 +64,7 @@ class GridRowCache {
     await _cellCache.dispose();
   }
 
-  void applyChangesets(List<GridBlockChangeset> changesets) {
+  void applyChangesets(List<GridBlockChangesetPB> changesets) {
     for (final changeset in changesets) {
       _deleteRows(changeset.deletedRows);
       _insertRows(changeset.insertedRows);
@@ -95,7 +95,7 @@ class GridRowCache {
     _rowChangeReasonNotifier.receive(GridRowChangeReason.delete(deletedIndex));
   }
 
-  void _insertRows(List<InsertedRow> insertRows) {
+  void _insertRows(List<InsertedRowPB> insertRows) {
     if (insertRows.isEmpty) {
       return;
     }
@@ -113,7 +113,7 @@ class GridRowCache {
     _rowChangeReasonNotifier.receive(GridRowChangeReason.insert(insertIndexs));
   }
 
-  void _updateRows(List<UpdatedRow> updatedRows) {
+  void _updateRows(List<UpdatedRowPB> updatedRows) {
     if (updatedRows.isEmpty) {
       return;
     }
@@ -183,7 +183,7 @@ class GridRowCache {
   }
 
   GridCellMap loadGridCells(String rowId) {
-    final Row? data = _rowByRowId[rowId];
+    final GridRowPB? data = _rowByRowId[rowId];
     if (data == null) {
       _loadRow(rowId);
     }
@@ -191,7 +191,7 @@ class GridRowCache {
   }
 
   Future<void> _loadRow(String rowId) async {
-    final payload = GridRowIdPayload.create()
+    final payload = GridRowIdPayloadPB.create()
       ..gridId = gridId
       ..blockId = block.id
       ..rowId = rowId;
@@ -203,7 +203,7 @@ class GridRowCache {
     );
   }
 
-  GridCellMap _makeGridCells(String rowId, Row? row) {
+  GridCellMap _makeGridCells(String rowId, GridRowPB? row) {
     var cellDataMap = GridCellMap.new();
     for (final field in _fieldNotifier.fields) {
       if (field.visibility) {
@@ -217,7 +217,7 @@ class GridRowCache {
     return cellDataMap;
   }
 
-  void _refreshRow(OptionalRow optionRow) {
+  void _refreshRow(OptionalRowPB optionRow) {
     if (!optionRow.hasRow()) {
       return;
     }
@@ -277,8 +277,8 @@ class RowService {
 
   RowService({required this.gridId, required this.blockId, required this.rowId});
 
-  Future<Either<Row, FlowyError>> createRow() {
-    CreateRowPayload payload = CreateRowPayload.create()
+  Future<Either<GridRowPB, FlowyError>> createRow() {
+    CreateRowPayloadPB payload = CreateRowPayloadPB.create()
       ..gridId = gridId
       ..startRowId = rowId;
 
@@ -286,18 +286,18 @@ class RowService {
   }
 
   Future<Either<Unit, FlowyError>> moveRow(String rowId, int fromIndex, int toIndex) {
-    final payload = MoveItemPayload.create()
+    final payload = MoveItemPayloadPB.create()
       ..gridId = gridId
       ..itemId = rowId
-      ..ty = MoveItemType.MoveRow
+      ..ty = MoveItemTypePB.MoveRow
       ..fromIndex = fromIndex
       ..toIndex = toIndex;
 
     return GridEventMoveItem(payload).send();
   }
 
-  Future<Either<OptionalRow, FlowyError>> getRow() {
-    final payload = GridRowIdPayload.create()
+  Future<Either<OptionalRowPB, FlowyError>> getRow() {
+    final payload = GridRowIdPayloadPB.create()
       ..gridId = gridId
       ..blockId = blockId
       ..rowId = rowId;
@@ -306,7 +306,7 @@ class RowService {
   }
 
   Future<Either<Unit, FlowyError>> deleteRow() {
-    final payload = GridRowIdPayload.create()
+    final payload = GridRowIdPayloadPB.create()
       ..gridId = gridId
       ..blockId = blockId
       ..rowId = rowId;
@@ -315,7 +315,7 @@ class RowService {
   }
 
   Future<Either<Unit, FlowyError>> duplicateRow() {
-    final payload = GridRowIdPayload.create()
+    final payload = GridRowIdPayloadPB.create()
       ..gridId = gridId
       ..blockId = blockId
       ..rowId = rowId;
@@ -330,9 +330,9 @@ class GridRowInfo with _$GridRowInfo {
     required String gridId,
     required String blockId,
     required String id,
-    required UnmodifiableListView<Field> fields,
+    required UnmodifiableListView<GridFieldPB> fields,
     required double height,
-    Row? rawRow,
+    GridRowPB? rawRow,
   }) = _GridRowInfo;
 }
 

+ 4 - 4
frontend/app_flowy/lib/workspace/application/grid/setting/property_bloc.dart

@@ -10,7 +10,7 @@ part 'property_bloc.freezed.dart';
 
 class GridPropertyBloc extends Bloc<GridPropertyEvent, GridPropertyState> {
   final GridFieldCache _fieldCache;
-  Function(List<Field>)? _onFieldsFn;
+  Function(List<GridFieldPB>)? _onFieldsFn;
 
   GridPropertyBloc({required String gridId, required GridFieldCache fieldCache})
       : _fieldCache = fieldCache,
@@ -62,7 +62,7 @@ class GridPropertyBloc extends Bloc<GridPropertyEvent, GridPropertyState> {
 class GridPropertyEvent with _$GridPropertyEvent {
   const factory GridPropertyEvent.initial() = _Initial;
   const factory GridPropertyEvent.setFieldVisibility(String fieldId, bool visibility) = _SetFieldVisibility;
-  const factory GridPropertyEvent.didReceiveFieldUpdate(List<Field> fields) = _DidReceiveFieldUpdate;
+  const factory GridPropertyEvent.didReceiveFieldUpdate(List<GridFieldPB> fields) = _DidReceiveFieldUpdate;
   const factory GridPropertyEvent.moveField(int fromIndex, int toIndex) = _MoveField;
 }
 
@@ -70,10 +70,10 @@ class GridPropertyEvent with _$GridPropertyEvent {
 class GridPropertyState with _$GridPropertyState {
   const factory GridPropertyState({
     required String gridId,
-    required List<Field> fields,
+    required List<GridFieldPB> fields,
   }) = _GridPropertyState;
 
-  factory GridPropertyState.initial(String gridId, List<Field> fields) => GridPropertyState(
+  factory GridPropertyState.initial(String gridId, List<GridFieldPB> fields) => GridPropertyState(
         gridId: gridId,
         fields: fields,
       );

+ 1 - 1
frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/layout/layout.dart

@@ -2,7 +2,7 @@ import 'package:flowy_sdk/protobuf/flowy-grid/field_entities.pb.dart';
 import 'sizes.dart';
 
 class GridLayout {
-  static double headerWidth(List<Field> fields) {
+  static double headerWidth(List<GridFieldPB> fields) {
     if (fields.isEmpty) return 0;
 
     final fieldsWidth = fields.map((field) => field.width.toDouble()).reduce((value, element) => value + element);

+ 22 - 22
frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/select_option_cell/extension.dart

@@ -7,27 +7,27 @@ import 'package:easy_localization/easy_localization.dart';
 import 'package:app_flowy/generated/locale_keys.g.dart';
 import 'package:flutter_bloc/flutter_bloc.dart';
 
-extension SelectOptionColorExtension on SelectOptionColor {
+extension SelectOptionColorExtension on SelectOptionColorPB {
   Color make(BuildContext context) {
     final theme = context.watch<AppTheme>();
     switch (this) {
-      case SelectOptionColor.Purple:
+      case SelectOptionColorPB.Purple:
         return theme.tint1;
-      case SelectOptionColor.Pink:
+      case SelectOptionColorPB.Pink:
         return theme.tint2;
-      case SelectOptionColor.LightPink:
+      case SelectOptionColorPB.LightPink:
         return theme.tint3;
-      case SelectOptionColor.Orange:
+      case SelectOptionColorPB.Orange:
         return theme.tint4;
-      case SelectOptionColor.Yellow:
+      case SelectOptionColorPB.Yellow:
         return theme.tint5;
-      case SelectOptionColor.Lime:
+      case SelectOptionColorPB.Lime:
         return theme.tint6;
-      case SelectOptionColor.Green:
+      case SelectOptionColorPB.Green:
         return theme.tint7;
-      case SelectOptionColor.Aqua:
+      case SelectOptionColorPB.Aqua:
         return theme.tint8;
-      case SelectOptionColor.Blue:
+      case SelectOptionColorPB.Blue:
         return theme.tint9;
       default:
         throw ArgumentError;
@@ -36,23 +36,23 @@ extension SelectOptionColorExtension on SelectOptionColor {
 
   String optionName() {
     switch (this) {
-      case SelectOptionColor.Purple:
+      case SelectOptionColorPB.Purple:
         return LocaleKeys.grid_selectOption_purpleColor.tr();
-      case SelectOptionColor.Pink:
+      case SelectOptionColorPB.Pink:
         return LocaleKeys.grid_selectOption_pinkColor.tr();
-      case SelectOptionColor.LightPink:
+      case SelectOptionColorPB.LightPink:
         return LocaleKeys.grid_selectOption_lightPinkColor.tr();
-      case SelectOptionColor.Orange:
+      case SelectOptionColorPB.Orange:
         return LocaleKeys.grid_selectOption_orangeColor.tr();
-      case SelectOptionColor.Yellow:
+      case SelectOptionColorPB.Yellow:
         return LocaleKeys.grid_selectOption_yellowColor.tr();
-      case SelectOptionColor.Lime:
+      case SelectOptionColorPB.Lime:
         return LocaleKeys.grid_selectOption_limeColor.tr();
-      case SelectOptionColor.Green:
+      case SelectOptionColorPB.Green:
         return LocaleKeys.grid_selectOption_greenColor.tr();
-      case SelectOptionColor.Aqua:
+      case SelectOptionColorPB.Aqua:
         return LocaleKeys.grid_selectOption_aquaColor.tr();
-      case SelectOptionColor.Blue:
+      case SelectOptionColorPB.Blue:
         return LocaleKeys.grid_selectOption_blueColor.tr();
       default:
         throw ArgumentError;
@@ -75,7 +75,7 @@ class SelectOptionTag extends StatelessWidget {
 
   factory SelectOptionTag.fromSelectOption({
     required BuildContext context,
-    required SelectOption option,
+    required SelectOptionPB option,
     VoidCallback? onSelected,
     bool isSelected = false,
   }) {
@@ -107,8 +107,8 @@ class SelectOptionTag extends StatelessWidget {
 
 class SelectOptionTagCell extends StatelessWidget {
   final List<Widget> children;
-  final void Function(SelectOption) onSelected;
-  final SelectOption option;
+  final void Function(SelectOptionPB) onSelected;
+  final SelectOptionPB option;
   const SelectOptionTagCell({
     required this.option,
     required this.onSelected,

+ 1 - 1
frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/select_option_cell/select_option_cell.dart

@@ -128,7 +128,7 @@ class _MultiSelectCellState extends State<MultiSelectCell> {
 }
 
 class _SelectOptionCell extends StatelessWidget {
-  final List<SelectOption> selectOptions;
+  final List<SelectOptionPB> selectOptions;
   final void Function(bool) onFocus;
   final SelectOptionCellStyle? cellStyle;
   final GridCellControllerBuilder cellContorllerBuilder;

+ 2 - 2
frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/select_option_cell/select_option_editor.dart

@@ -146,7 +146,7 @@ class _TextField extends StatelessWidget {
   Widget build(BuildContext context) {
     return BlocBuilder<SelectOptionCellEditorBloc, SelectOptionEditorState>(
       builder: (context, state) {
-        final optionMap = LinkedHashMap<String, SelectOption>.fromIterable(state.selectedOptions,
+        final optionMap = LinkedHashMap<String, SelectOptionPB>.fromIterable(state.selectedOptions,
             key: (option) => option.name, value: (option) => option);
 
         return SizedBox(
@@ -216,7 +216,7 @@ class _CreateOptionCell extends StatelessWidget {
 }
 
 class _SelectOptionCell extends StatelessWidget {
-  final SelectOption option;
+  final SelectOptionPB option;
   final bool isSelected;
   const _SelectOptionCell(this.option, this.isSelected, {Key? key}) : super(key: key);
 

+ 2 - 2
frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/select_option_cell/text_field.dart

@@ -15,8 +15,8 @@ class SelectOptionTextField extends StatelessWidget {
   final FocusNode _focusNode;
   final TextEditingController _controller;
   final TextfieldTagsController tagController;
-  final List<SelectOption> options;
-  final LinkedHashMap<String, SelectOption> selectedOptionMap;
+  final List<SelectOptionPB> options;
+  final LinkedHashMap<String, SelectOptionPB> selectedOptionMap;
 
   final double distanceToText;
 

+ 1 - 1
frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_cell.dart

@@ -135,7 +135,7 @@ class _DragToExpandLine extends StatelessWidget {
 
 class FieldCellButton extends StatelessWidget {
   final VoidCallback onTap;
-  final Field field;
+  final GridFieldPB field;
   const FieldCellButton({
     required this.field,
     required this.onTap,

+ 3 - 3
frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_type_option_editor.dart

@@ -15,8 +15,8 @@ import 'package:app_flowy/workspace/presentation/plugins/grid/src/widgets/header
 import 'field_type_extension.dart';
 import 'type_option/builder.dart';
 
-typedef UpdateFieldCallback = void Function(Field, Uint8List);
-typedef SwitchToFieldCallback = Future<Either<FieldTypeOptionData, FlowyError>> Function(
+typedef UpdateFieldCallback = void Function(GridFieldPB, Uint8List);
+typedef SwitchToFieldCallback = Future<Either<FieldTypeOptionDataPB, FlowyError>> Function(
   String fieldId,
   FieldType fieldType,
 );
@@ -59,7 +59,7 @@ class _FieldTypeOptionEditorState extends State<FieldTypeOptionEditor> {
     );
   }
 
-  Widget _switchFieldTypeButton(BuildContext context, Field field) {
+  Widget _switchFieldTypeButton(BuildContext context, GridFieldPB field) {
     final theme = context.watch<AppTheme>();
     return SizedBox(
       height: GridSize.typeOptionItemHeight,

+ 1 - 1
frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/grid_header.dart

@@ -160,7 +160,7 @@ class CreateFieldButton extends StatelessWidget {
 
 class SliverHeaderDelegateImplementation extends SliverPersistentHeaderDelegate {
   final String gridId;
-  final List<Field> fields;
+  final List<GridFieldPB> fields;
 
   SliverHeaderDelegateImplementation({required this.gridId, required this.fields});
 

+ 4 - 4
frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/type_option/select_option.dart

@@ -17,7 +17,7 @@ import 'builder.dart';
 import 'select_option_editor.dart';
 
 class SelectOptionTypeOptionWidget extends StatelessWidget {
-  final List<SelectOption> options;
+  final List<SelectOptionPB> options;
   final VoidCallback beginEdit;
   final TypeOptionOverlayDelegate overlayDelegate;
   final SelectOptionTypeOptionAction typeOptionAction;
@@ -131,7 +131,7 @@ class _OptionList extends StatelessWidget {
     );
   }
 
-  _OptionCell _makeOptionCell(BuildContext context, SelectOption option) {
+  _OptionCell _makeOptionCell(BuildContext context, SelectOptionPB option) {
     return _OptionCell(
       option: option,
       onSelected: (option) {
@@ -154,8 +154,8 @@ class _OptionList extends StatelessWidget {
 }
 
 class _OptionCell extends StatelessWidget {
-  final SelectOption option;
-  final Function(SelectOption) onSelected;
+  final SelectOptionPB option;
+  final Function(SelectOptionPB) onSelected;
   const _OptionCell({
     required this.option,
     required this.onSelected,

+ 5 - 5
frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/type_option/select_option_editor.dart

@@ -15,9 +15,9 @@ import 'package:easy_localization/easy_localization.dart';
 import 'package:app_flowy/generated/locale_keys.g.dart';
 
 class SelectOptionTypeOptionEditor extends StatelessWidget {
-  final SelectOption option;
+  final SelectOptionPB option;
   final VoidCallback onDeleted;
-  final Function(SelectOption) onUpdated;
+  final Function(SelectOptionPB) onUpdated;
   const SelectOptionTypeOptionEditor({
     required this.option,
     required this.onDeleted,
@@ -110,12 +110,12 @@ class _OptionNameTextField extends StatelessWidget {
 }
 
 class SelectOptionColorList extends StatelessWidget {
-  final SelectOptionColor selectedColor;
+  final SelectOptionColorPB selectedColor;
   const SelectOptionColorList({required this.selectedColor, Key? key}) : super(key: key);
 
   @override
   Widget build(BuildContext context) {
-    final cells = SelectOptionColor.values.map((color) {
+    final cells = SelectOptionColorPB.values.map((color) {
       return _SelectOptionColorCell(color: color, isSelected: selectedColor == color);
     }).toList();
 
@@ -152,7 +152,7 @@ class SelectOptionColorList extends StatelessWidget {
 }
 
 class _SelectOptionColorCell extends StatelessWidget {
-  final SelectOptionColor color;
+  final SelectOptionColorPB color;
   final bool isSelected;
   const _SelectOptionColorCell({required this.color, required this.isSelected, Key? key}) : super(key: key);
 

+ 1 - 1
frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/toolbar/grid_property.dart

@@ -75,7 +75,7 @@ class GridPropertyList extends StatelessWidget with FlowyOverlayDelegate {
 }
 
 class _GridPropertyCell extends StatelessWidget {
-  final Field field;
+  final GridFieldPB field;
   final String gridId;
   const _GridPropertyCell({required this.gridId, required this.field, Key? key}) : super(key: key);
 

+ 1 - 1
frontend/app_flowy/lib/workspace/presentation/widgets/emoji_picker/src/emoji_lists.dart

@@ -1632,7 +1632,7 @@ final Map<String, String> activities = Map.fromIterables([
   'Flying Disc',
   'Bowling',
   'Cricket Game',
-  'Field Hockey',
+  'GridFieldPB Hockey',
   'Ice Hockey',
   'Lacrosse',
   'Ping Pong',

+ 23 - 23
frontend/rust-lib/flowy-grid/src/entities/cell_entities.rs

@@ -1,4 +1,4 @@
-use crate::entities::{FieldIdentifier, FieldIdentifierPayloadPB};
+use crate::entities::{FieldIdentifierParams, GridFieldIdentifierPayloadPB};
 use flowy_derive::ProtoBuf;
 use flowy_error::ErrorCode;
 use flowy_grid_data_model::parser::NotEmptyStr;
@@ -6,28 +6,28 @@ use flowy_grid_data_model::revision::{CellRevision, RowMetaChangeset};
 use std::collections::HashMap;
 
 #[derive(ProtoBuf, Default)]
-pub struct CreateSelectOptionPayload {
+pub struct CreateSelectOptionPayloadPB {
     #[pb(index = 1)]
-    pub field_identifier: FieldIdentifierPayloadPB,
+    pub field_identifier: GridFieldIdentifierPayloadPB,
 
     #[pb(index = 2)]
     pub option_name: String,
 }
 
 pub struct CreateSelectOptionParams {
-    pub field_identifier: FieldIdentifier,
+    pub field_identifier: FieldIdentifierParams,
     pub option_name: String,
 }
 
 impl std::ops::Deref for CreateSelectOptionParams {
-    type Target = FieldIdentifier;
+    type Target = FieldIdentifierParams;
 
     fn deref(&self) -> &Self::Target {
         &self.field_identifier
     }
 }
 
-impl TryInto<CreateSelectOptionParams> for CreateSelectOptionPayload {
+impl TryInto<CreateSelectOptionParams> for CreateSelectOptionPayloadPB {
     type Error = ErrorCode;
 
     fn try_into(self) -> Result<CreateSelectOptionParams, Self::Error> {
@@ -41,7 +41,7 @@ impl TryInto<CreateSelectOptionParams> for CreateSelectOptionPayload {
 }
 
 #[derive(Debug, Clone, Default, ProtoBuf)]
-pub struct CellIdentifierPayload {
+pub struct GridCellIdentifierPayloadPB {
     #[pb(index = 1)]
     pub grid_id: String,
 
@@ -52,20 +52,20 @@ pub struct CellIdentifierPayload {
     pub row_id: String,
 }
 
-pub struct CellIdentifier {
+pub struct CellIdentifierParams {
     pub grid_id: String,
     pub field_id: String,
     pub row_id: String,
 }
 
-impl TryInto<CellIdentifier> for CellIdentifierPayload {
+impl TryInto<CellIdentifierParams> for GridCellIdentifierPayloadPB {
     type Error = ErrorCode;
 
-    fn try_into(self) -> Result<CellIdentifier, Self::Error> {
+    fn try_into(self) -> Result<CellIdentifierParams, Self::Error> {
         let grid_id = NotEmptyStr::parse(self.grid_id).map_err(|_| ErrorCode::GridIdIsEmpty)?;
         let field_id = NotEmptyStr::parse(self.field_id).map_err(|_| ErrorCode::FieldIdIsEmpty)?;
         let row_id = NotEmptyStr::parse(self.row_id).map_err(|_| ErrorCode::RowIdIsEmpty)?;
-        Ok(CellIdentifier {
+        Ok(CellIdentifierParams {
             grid_id: grid_id.0,
             field_id: field_id.0,
             row_id: row_id.0,
@@ -73,7 +73,7 @@ impl TryInto<CellIdentifier> for CellIdentifierPayload {
     }
 }
 #[derive(Debug, Default, ProtoBuf)]
-pub struct Cell {
+pub struct GridCellPB {
     #[pb(index = 1)]
     pub field_id: String,
 
@@ -81,7 +81,7 @@ pub struct Cell {
     pub data: Vec<u8>,
 }
 
-impl Cell {
+impl GridCellPB {
     pub fn new(field_id: &str, data: Vec<u8>) -> Self {
         Self {
             field_id: field_id.to_owned(),
@@ -98,32 +98,32 @@ impl Cell {
 }
 
 #[derive(Debug, Default, ProtoBuf)]
-pub struct RepeatedCell {
+pub struct RepeatedCellPB {
     #[pb(index = 1)]
-    pub items: Vec<Cell>,
+    pub items: Vec<GridCellPB>,
 }
 
-impl std::ops::Deref for RepeatedCell {
-    type Target = Vec<Cell>;
+impl std::ops::Deref for RepeatedCellPB {
+    type Target = Vec<GridCellPB>;
     fn deref(&self) -> &Self::Target {
         &self.items
     }
 }
 
-impl std::ops::DerefMut for RepeatedCell {
+impl std::ops::DerefMut for RepeatedCellPB {
     fn deref_mut(&mut self) -> &mut Self::Target {
         &mut self.items
     }
 }
 
-impl std::convert::From<Vec<Cell>> for RepeatedCell {
-    fn from(items: Vec<Cell>) -> Self {
+impl std::convert::From<Vec<GridCellPB>> for RepeatedCellPB {
+    fn from(items: Vec<GridCellPB>) -> Self {
         Self { items }
     }
 }
 
 #[derive(Debug, Clone, Default, ProtoBuf)]
-pub struct CellChangeset {
+pub struct CellChangesetPB {
     #[pb(index = 1)]
     pub grid_id: String,
 
@@ -137,8 +137,8 @@ pub struct CellChangeset {
     pub content: Option<String>,
 }
 
-impl std::convert::From<CellChangeset> for RowMetaChangeset {
-    fn from(changeset: CellChangeset) -> Self {
+impl std::convert::From<CellChangesetPB> for RowMetaChangeset {
+    fn from(changeset: CellChangesetPB) -> Self {
         let mut cell_by_field_id = HashMap::with_capacity(1);
         let field_id = changeset.field_id;
         let cell_rev = CellRevision {

+ 44 - 44
frontend/rust-lib/flowy-grid/src/entities/field_entities.rs

@@ -9,7 +9,7 @@ use std::sync::Arc;
 use strum_macros::{Display, EnumCount as EnumCountMacro, EnumIter, EnumString};
 
 #[derive(Debug, Clone, Default, ProtoBuf)]
-pub struct FieldPB {
+pub struct GridFieldPB {
     #[pb(index = 1)]
     pub id: String,
 
@@ -35,7 +35,7 @@ pub struct FieldPB {
     pub is_primary: bool,
 }
 
-impl std::convert::From<FieldRevision> for FieldPB {
+impl std::convert::From<FieldRevision> for GridFieldPB {
     fn from(field_rev: FieldRevision) -> Self {
         Self {
             id: field_rev.id,
@@ -50,31 +50,31 @@ impl std::convert::From<FieldRevision> for FieldPB {
     }
 }
 
-impl std::convert::From<Arc<FieldRevision>> for FieldPB {
+impl std::convert::From<Arc<FieldRevision>> for GridFieldPB {
     fn from(field_rev: Arc<FieldRevision>) -> Self {
         let field_rev = field_rev.as_ref().clone();
-        FieldPB::from(field_rev)
+        GridFieldPB::from(field_rev)
     }
 }
 #[derive(Debug, Clone, Default, ProtoBuf)]
-pub struct GridFieldPB {
+pub struct GridFieldIdPB {
     #[pb(index = 1)]
     pub field_id: String,
 }
 
-impl std::convert::From<&str> for GridFieldPB {
+impl std::convert::From<&str> for GridFieldIdPB {
     fn from(s: &str) -> Self {
-        GridFieldPB { field_id: s.to_owned() }
+        GridFieldIdPB { field_id: s.to_owned() }
     }
 }
 
-impl std::convert::From<String> for GridFieldPB {
+impl std::convert::From<String> for GridFieldIdPB {
     fn from(s: String) -> Self {
-        GridFieldPB { field_id: s }
+        GridFieldIdPB { field_id: s }
     }
 }
 
-impl std::convert::From<&Arc<FieldRevision>> for GridFieldPB {
+impl std::convert::From<&Arc<FieldRevision>> for GridFieldIdPB {
     fn from(field_rev: &Arc<FieldRevision>) -> Self {
         Self {
             field_id: field_rev.id.clone(),
@@ -90,10 +90,10 @@ pub struct GridFieldChangesetPB {
     pub inserted_fields: Vec<IndexFieldPB>,
 
     #[pb(index = 3)]
-    pub deleted_fields: Vec<GridFieldPB>,
+    pub deleted_fields: Vec<GridFieldIdPB>,
 
     #[pb(index = 4)]
-    pub updated_fields: Vec<FieldPB>,
+    pub updated_fields: Vec<GridFieldPB>,
 }
 
 impl GridFieldChangesetPB {
@@ -106,7 +106,7 @@ impl GridFieldChangesetPB {
         }
     }
 
-    pub fn delete(grid_id: &str, deleted_fields: Vec<GridFieldPB>) -> Self {
+    pub fn delete(grid_id: &str, deleted_fields: Vec<GridFieldIdPB>) -> Self {
         Self {
             grid_id: grid_id.to_string(),
             inserted_fields: vec![],
@@ -115,7 +115,7 @@ impl GridFieldChangesetPB {
         }
     }
 
-    pub fn update(grid_id: &str, updated_fields: Vec<FieldPB>) -> Self {
+    pub fn update(grid_id: &str, updated_fields: Vec<GridFieldPB>) -> Self {
         Self {
             grid_id: grid_id.to_string(),
             inserted_fields: vec![],
@@ -128,7 +128,7 @@ impl GridFieldChangesetPB {
 #[derive(Debug, Clone, Default, ProtoBuf)]
 pub struct IndexFieldPB {
     #[pb(index = 1)]
-    pub field: FieldPB,
+    pub field: GridFieldPB,
 
     #[pb(index = 2)]
     pub index: i32,
@@ -137,7 +137,7 @@ pub struct IndexFieldPB {
 impl IndexFieldPB {
     pub fn from_field_rev(field_rev: &Arc<FieldRevision>, index: usize) -> Self {
         Self {
-            field: FieldPB::from(field_rev.as_ref().clone()),
+            field: GridFieldPB::from(field_rev.as_ref().clone()),
             index: index as i32,
         }
     }
@@ -214,59 +214,59 @@ pub struct FieldTypeOptionDataPB {
     pub grid_id: String,
 
     #[pb(index = 2)]
-    pub field: FieldPB,
+    pub field: GridFieldPB,
 
     #[pb(index = 3)]
     pub type_option_data: Vec<u8>,
 }
 
 #[derive(Debug, Default, ProtoBuf)]
-pub struct RepeatedFieldPB {
+pub struct RepeatedGridFieldPB {
     #[pb(index = 1)]
-    pub items: Vec<FieldPB>,
+    pub items: Vec<GridFieldPB>,
 }
-impl std::ops::Deref for RepeatedFieldPB {
-    type Target = Vec<FieldPB>;
+impl std::ops::Deref for RepeatedGridFieldPB {
+    type Target = Vec<GridFieldPB>;
     fn deref(&self) -> &Self::Target {
         &self.items
     }
 }
 
-impl std::ops::DerefMut for RepeatedFieldPB {
+impl std::ops::DerefMut for RepeatedGridFieldPB {
     fn deref_mut(&mut self) -> &mut Self::Target {
         &mut self.items
     }
 }
 
-impl std::convert::From<Vec<FieldPB>> for RepeatedFieldPB {
-    fn from(items: Vec<FieldPB>) -> Self {
+impl std::convert::From<Vec<GridFieldPB>> for RepeatedGridFieldPB {
+    fn from(items: Vec<GridFieldPB>) -> Self {
         Self { items }
     }
 }
 
 #[derive(Debug, Clone, Default, ProtoBuf)]
-pub struct RepeatedGridFieldPB {
+pub struct RepeatedGridFieldIdPB {
     #[pb(index = 1)]
-    pub items: Vec<GridFieldPB>,
+    pub items: Vec<GridFieldIdPB>,
 }
 
-impl std::ops::Deref for RepeatedGridFieldPB {
-    type Target = Vec<GridFieldPB>;
+impl std::ops::Deref for RepeatedGridFieldIdPB {
+    type Target = Vec<GridFieldIdPB>;
     fn deref(&self) -> &Self::Target {
         &self.items
     }
 }
 
-impl std::convert::From<Vec<GridFieldPB>> for RepeatedGridFieldPB {
-    fn from(field_orders: Vec<GridFieldPB>) -> Self {
-        RepeatedGridFieldPB { items: field_orders }
+impl std::convert::From<Vec<GridFieldIdPB>> for RepeatedGridFieldIdPB {
+    fn from(items: Vec<GridFieldIdPB>) -> Self {
+        RepeatedGridFieldIdPB { items }
     }
 }
 
-impl std::convert::From<String> for RepeatedGridFieldPB {
+impl std::convert::From<String> for RepeatedGridFieldIdPB {
     fn from(s: String) -> Self {
-        RepeatedGridFieldPB {
-            items: vec![GridFieldPB::from(s)],
+        RepeatedGridFieldIdPB {
+            items: vec![GridFieldIdPB::from(s)],
         }
     }
 }
@@ -277,7 +277,7 @@ pub struct InsertFieldPayloadPB {
     pub grid_id: String,
 
     #[pb(index = 2)]
-    pub field: FieldPB,
+    pub field: GridFieldPB,
 
     #[pb(index = 3)]
     pub type_option_data: Vec<u8>,
@@ -289,7 +289,7 @@ pub struct InsertFieldPayloadPB {
 #[derive(Clone)]
 pub struct InsertFieldParams {
     pub grid_id: String,
-    pub field: FieldPB,
+    pub field: GridFieldPB,
     pub type_option_data: Vec<u8>,
     pub start_field_id: Option<String>,
 }
@@ -355,12 +355,12 @@ pub struct QueryFieldPayloadPB {
     pub grid_id: String,
 
     #[pb(index = 2)]
-    pub field_orders: RepeatedGridFieldPB,
+    pub field_ids: RepeatedGridFieldIdPB,
 }
 
 pub struct QueryFieldParams {
     pub grid_id: String,
-    pub field_orders: RepeatedGridFieldPB,
+    pub field_ids: RepeatedGridFieldIdPB,
 }
 
 impl TryInto<QueryFieldParams> for QueryFieldPayloadPB {
@@ -370,7 +370,7 @@ impl TryInto<QueryFieldParams> for QueryFieldPayloadPB {
         let grid_id = NotEmptyStr::parse(self.grid_id).map_err(|_| ErrorCode::GridIdIsEmpty)?;
         Ok(QueryFieldParams {
             grid_id: grid_id.0,
-            field_orders: self.field_orders,
+            field_ids: self.field_ids,
         })
     }
 }
@@ -557,7 +557,7 @@ impl std::convert::From<FieldTypeRevision> for FieldType {
     }
 }
 #[derive(Debug, Clone, Default, ProtoBuf)]
-pub struct FieldIdentifierPayloadPB {
+pub struct GridFieldIdentifierPayloadPB {
     #[pb(index = 1)]
     pub field_id: String,
 
@@ -565,18 +565,18 @@ pub struct FieldIdentifierPayloadPB {
     pub grid_id: String,
 }
 
-pub struct FieldIdentifier {
+pub struct FieldIdentifierParams {
     pub field_id: String,
     pub grid_id: String,
 }
 
-impl TryInto<FieldIdentifier> for FieldIdentifierPayloadPB {
+impl TryInto<FieldIdentifierParams> for GridFieldIdentifierPayloadPB {
     type Error = ErrorCode;
 
-    fn try_into(self) -> Result<FieldIdentifier, Self::Error> {
+    fn try_into(self) -> Result<FieldIdentifierParams, Self::Error> {
         let grid_id = NotEmptyStr::parse(self.grid_id).map_err(|_| ErrorCode::GridIdIsEmpty)?;
         let field_id = NotEmptyStr::parse(self.field_id).map_err(|_| ErrorCode::FieldIdIsEmpty)?;
-        Ok(FieldIdentifier {
+        Ok(FieldIdentifierParams {
             grid_id: grid_id.0,
             field_id: field_id.0,
         })

+ 2 - 2
frontend/rust-lib/flowy-grid/src/entities/grid_entities.rs

@@ -1,4 +1,4 @@
-use crate::entities::{GridBlockPB, GridFieldPB};
+use crate::entities::{GridBlockPB, GridFieldIdPB};
 use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
 use flowy_error::ErrorCode;
 use flowy_grid_data_model::parser::NotEmptyStr;
@@ -8,7 +8,7 @@ pub struct GridPB {
     pub id: String,
 
     #[pb(index = 2)]
-    pub fields: Vec<GridFieldPB>,
+    pub fields: Vec<GridFieldIdPB>,
 
     #[pb(index = 3)]
     pub blocks: Vec<GridBlockPB>,

+ 20 - 20
frontend/rust-lib/flowy-grid/src/event_handler.rs

@@ -3,9 +3,9 @@ use crate::manager::GridManager;
 use crate::services::cell::AnyCellData;
 use crate::services::field::{
     default_type_option_builder_from_type, select_option_operation, type_option_builder_from_json_str,
-    DateChangesetParams, DateChangesetPayloadPB, SelectOptionPB, SelectOptionCellChangeset,
-    SelectOptionCellChangesetParams, SelectOptionCellChangesetPayloadPB, SelectOptionCellDataPB, SelectOptionChangeset,
-    SelectOptionChangesetPayloadPB,
+    DateChangesetParams, DateChangesetPayloadPB, SelectOptionCellChangeset, SelectOptionCellChangesetParams,
+    SelectOptionCellChangesetPayloadPB, SelectOptionCellDataPB, SelectOptionChangeset, SelectOptionChangesetPayloadPB,
+    SelectOptionPB,
 };
 use crate::services::row::make_row_from_row_rev;
 use flowy_error::{ErrorCode, FlowyError, FlowyResult};
@@ -62,17 +62,17 @@ pub(crate) async fn get_grid_blocks_handler(
 pub(crate) async fn get_fields_handler(
     data: Data<QueryFieldPayloadPB>,
     manager: AppData<Arc<GridManager>>,
-) -> DataResult<RepeatedFieldPB, FlowyError> {
+) -> DataResult<RepeatedGridFieldPB, FlowyError> {
     let params: QueryFieldParams = data.into_inner().try_into()?;
     let editor = manager.get_grid_editor(&params.grid_id)?;
     let field_orders = params
-        .field_orders
+        .field_ids
         .items
         .into_iter()
         .map(|field_order| field_order.field_id)
         .collect();
     let field_revs = editor.get_field_revs(Some(field_orders)).await?;
-    let repeated_field: RepeatedFieldPB = field_revs.into_iter().map(FieldPB::from).collect::<Vec<_>>().into();
+    let repeated_field: RepeatedGridFieldPB = field_revs.into_iter().map(GridFieldPB::from).collect::<Vec<_>>().into();
     data_result(repeated_field)
 }
 
@@ -113,10 +113,10 @@ pub(crate) async fn update_field_type_option_handler(
 
 #[tracing::instrument(level = "trace", skip(data, manager), err)]
 pub(crate) async fn delete_field_handler(
-    data: Data<FieldIdentifierPayloadPB>,
+    data: Data<GridFieldIdentifierPayloadPB>,
     manager: AppData<Arc<GridManager>>,
 ) -> Result<(), FlowyError> {
-    let params: FieldIdentifier = data.into_inner().try_into()?;
+    let params: FieldIdentifierParams = data.into_inner().try_into()?;
     let editor = manager.get_grid_editor(&params.grid_id)?;
     let _ = editor.delete_field(&params.field_id).await?;
     Ok(())
@@ -151,10 +151,10 @@ pub(crate) async fn switch_to_field_handler(
 
 #[tracing::instrument(level = "trace", skip(data, manager), err)]
 pub(crate) async fn duplicate_field_handler(
-    data: Data<FieldIdentifierPayloadPB>,
+    data: Data<GridFieldIdentifierPayloadPB>,
     manager: AppData<Arc<GridManager>>,
 ) -> Result<(), FlowyError> {
-    let params: FieldIdentifier = data.into_inner().try_into()?;
+    let params: FieldIdentifierParams = data.into_inner().try_into()?;
     let editor = manager.get_grid_editor(&params.grid_id)?;
     let _ = editor.duplicate_field(&params.field_id).await?;
     Ok(())
@@ -275,23 +275,23 @@ pub(crate) async fn create_row_handler(
 
 // #[tracing::instrument(level = "debug", skip_all, err)]
 pub(crate) async fn get_cell_handler(
-    data: Data<CellIdentifierPayload>,
+    data: Data<GridCellIdentifierPayloadPB>,
     manager: AppData<Arc<GridManager>>,
-) -> DataResult<Cell, FlowyError> {
-    let params: CellIdentifier = data.into_inner().try_into()?;
+) -> DataResult<GridCellPB, FlowyError> {
+    let params: CellIdentifierParams = data.into_inner().try_into()?;
     let editor = manager.get_grid_editor(&params.grid_id)?;
     match editor.get_cell(&params).await {
-        None => data_result(Cell::empty(&params.field_id)),
+        None => data_result(GridCellPB::empty(&params.field_id)),
         Some(cell) => data_result(cell),
     }
 }
 
 #[tracing::instrument(level = "trace", skip_all, err)]
 pub(crate) async fn update_cell_handler(
-    data: Data<CellChangeset>,
+    data: Data<CellChangesetPB>,
     manager: AppData<Arc<GridManager>>,
 ) -> Result<(), FlowyError> {
-    let changeset: CellChangeset = data.into_inner();
+    let changeset: CellChangesetPB = data.into_inner();
     let editor = manager.get_grid_editor(&changeset.grid_id)?;
     let _ = editor.update_cell(changeset).await?;
     Ok(())
@@ -299,7 +299,7 @@ pub(crate) async fn update_cell_handler(
 
 #[tracing::instrument(level = "trace", skip_all, err)]
 pub(crate) async fn new_select_option_handler(
-    data: Data<CreateSelectOptionPayload>,
+    data: Data<CreateSelectOptionPayloadPB>,
     manager: AppData<Arc<GridManager>>,
 ) -> DataResult<SelectOptionPB, FlowyError> {
     let params: CreateSelectOptionParams = data.into_inner().try_into()?;
@@ -344,7 +344,7 @@ pub(crate) async fn update_select_option_handler(
         mut_field_rev.insert_type_option_entry(&*type_option);
         let _ = editor.replace_field(field_rev).await?;
 
-        let changeset = CellChangeset {
+        let changeset = CellChangesetPB {
             grid_id: changeset.cell_identifier.grid_id,
             row_id: changeset.cell_identifier.row_id,
             field_id: changeset.cell_identifier.field_id,
@@ -357,10 +357,10 @@ pub(crate) async fn update_select_option_handler(
 
 #[tracing::instrument(level = "trace", skip(data, manager), err)]
 pub(crate) async fn get_select_option_handler(
-    data: Data<CellIdentifierPayload>,
+    data: Data<GridCellIdentifierPayloadPB>,
     manager: AppData<Arc<GridManager>>,
 ) -> DataResult<SelectOptionCellDataPB, FlowyError> {
-    let params: CellIdentifier = data.into_inner().try_into()?;
+    let params: CellIdentifierParams = data.into_inner().try_into()?;
     let editor = manager.get_grid_editor(&params.grid_id)?;
     match editor.get_field_rev(&params.field_id).await {
         None => {

+ 25 - 25
frontend/rust-lib/flowy-grid/src/event_map.rs

@@ -45,78 +45,78 @@ pub fn create(grid_manager: Arc<GridManager>) -> Module {
 #[derive(Clone, Copy, PartialEq, Eq, Debug, Display, Hash, ProtoBuf_Enum, Flowy_Event)]
 #[event_err = "FlowyError"]
 pub enum GridEvent {
-    #[event(input = "GridId", output = "Grid")]
+    #[event(input = "GridIdPB", output = "GridPB")]
     GetGrid = 0,
 
-    #[event(input = "QueryGridBlocksPayload", output = "RepeatedGridBlock")]
+    #[event(input = "QueryGridBlocksPayloadPB", output = "RepeatedGridBlockPB")]
     GetGridBlocks = 1,
 
-    #[event(input = "GridId", output = "GridSetting")]
+    #[event(input = "GridIdPB", output = "GridSettingPB")]
     GetGridSetting = 2,
 
-    #[event(input = "GridId", input = "GridSettingChangesetPayload")]
+    #[event(input = "GridIdPB", input = "GridSettingChangesetPayloadPB")]
     UpdateGridSetting = 3,
 
-    #[event(input = "QueryFieldPayload", output = "RepeatedField")]
+    #[event(input = "QueryFieldPayloadPB", output = "RepeatedGridFieldPB")]
     GetFields = 10,
 
-    #[event(input = "FieldChangesetPayload")]
+    #[event(input = "FieldChangesetPayloadPB")]
     UpdateField = 11,
 
-    #[event(input = "UpdateFieldTypeOptionPayload")]
+    #[event(input = "UpdateFieldTypeOptionPayloadPB")]
     UpdateFieldTypeOption = 12,
 
-    #[event(input = "InsertFieldPayload")]
+    #[event(input = "InsertFieldPayloadPB")]
     InsertField = 13,
 
-    #[event(input = "FieldIdentifierPayload")]
+    #[event(input = "GridFieldIdentifierPayloadPB")]
     DeleteField = 14,
 
-    #[event(input = "EditFieldPayload", output = "FieldTypeOptionData")]
+    #[event(input = "EditFieldPayloadPB", output = "FieldTypeOptionDataPB")]
     SwitchToField = 20,
 
-    #[event(input = "FieldIdentifierPayload")]
+    #[event(input = "GridFieldIdentifierPayloadPB")]
     DuplicateField = 21,
 
-    #[event(input = "MoveItemPayload")]
+    #[event(input = "MoveItemPayloadPB")]
     MoveItem = 22,
 
-    #[event(input = "EditFieldPayload", output = "FieldTypeOptionData")]
+    #[event(input = "EditFieldPayloadPB", output = "FieldTypeOptionDataPB")]
     GetFieldTypeOption = 23,
 
-    #[event(input = "EditFieldPayload", output = "FieldTypeOptionData")]
+    #[event(input = "EditFieldPayloadPB", output = "FieldTypeOptionDataPB")]
     CreateFieldTypeOption = 24,
 
-    #[event(input = "CreateSelectOptionPayload", output = "SelectOption")]
+    #[event(input = "CreateSelectOptionPayloadPB", output = "SelectOptionPB")]
     NewSelectOption = 30,
 
-    #[event(input = "CellIdentifierPayload", output = "SelectOptionCellData")]
+    #[event(input = "GridCellIdentifierPayloadPB", output = "SelectOptionCellDataPB")]
     GetSelectOptionCellData = 31,
 
-    #[event(input = "SelectOptionChangesetPayload")]
+    #[event(input = "SelectOptionChangesetPayloadPB")]
     UpdateSelectOption = 32,
 
-    #[event(input = "CreateRowPayload", output = "Row")]
+    #[event(input = "CreateRowPayloadPB", output = "GridRowPB")]
     CreateRow = 50,
 
-    #[event(input = "GridRowIdPayload", output = "OptionalRow")]
+    #[event(input = "GridRowIdPayloadPB", output = "OptionalRowPB")]
     GetRow = 51,
 
-    #[event(input = "GridRowIdPayload")]
+    #[event(input = "GridRowIdPayloadPB")]
     DeleteRow = 52,
 
-    #[event(input = "GridRowIdPayload")]
+    #[event(input = "GridRowIdPayloadPB")]
     DuplicateRow = 53,
 
-    #[event(input = "CellIdentifierPayload", output = "Cell")]
+    #[event(input = "GridCellIdentifierPayloadPB", output = "GridCellPB")]
     GetCell = 70,
 
-    #[event(input = "CellChangeset")]
+    #[event(input = "CellChangesetPB")]
     UpdateCell = 71,
 
-    #[event(input = "SelectOptionCellChangesetPayload")]
+    #[event(input = "SelectOptionCellChangesetPayloadPB")]
     UpdateSelectOptionCell = 72,
 
-    #[event(input = "DateChangesetPayload")]
+    #[event(input = "DateChangesetPayloadPB")]
     UpdateDateCell = 80,
 }

+ 3 - 3
frontend/rust-lib/flowy-grid/src/services/block_manager.rs

@@ -1,5 +1,5 @@
 use crate::dart_notification::{send_dart_notification, GridNotification};
-use crate::entities::{CellChangeset, GridBlockChangesetPB, GridRowPB, InsertedRowPB, UpdatedRowPB};
+use crate::entities::{CellChangesetPB, GridBlockChangesetPB, GridRowPB, InsertedRowPB, UpdatedRowPB};
 use crate::manager::GridUser;
 use crate::services::block_revision_editor::GridBlockRevisionEditor;
 use crate::services::persistence::block_index::BlockIndexCache;
@@ -196,7 +196,7 @@ impl GridBlockManager {
         Ok(())
     }
 
-    pub async fn update_cell<F>(&self, changeset: CellChangeset, row_builder: F) -> FlowyResult<()>
+    pub async fn update_cell<F>(&self, changeset: CellChangesetPB, row_builder: F) -> FlowyResult<()>
     where
         F: FnOnce(Arc<RowRevision>) -> Option<GridRowPB>,
     {
@@ -254,7 +254,7 @@ impl GridBlockManager {
         Ok(())
     }
 
-    async fn notify_did_update_cell(&self, changeset: CellChangeset) -> FlowyResult<()> {
+    async fn notify_did_update_cell(&self, changeset: CellChangesetPB) -> FlowyResult<()> {
         let id = format!("{}:{}", changeset.row_id, changeset.field_id);
         send_dart_notification(&id, GridNotification::DidUpdateCell).send();
         Ok(())

+ 2 - 2
frontend/rust-lib/flowy-grid/src/services/field/field_builder.rs

@@ -1,4 +1,4 @@
-use crate::entities::{FieldPB, FieldType};
+use crate::entities::{FieldType, GridFieldPB};
 use crate::services::field::type_options::*;
 use bytes::Bytes;
 use flowy_grid_data_model::revision::{FieldRevision, TypeOptionDataEntry};
@@ -28,7 +28,7 @@ impl FieldBuilder {
         Self::new(type_option_builder)
     }
 
-    pub fn from_field(field: FieldPB, type_option_builder: Box<dyn TypeOptionBuilder>) -> Self {
+    pub fn from_field(field: GridFieldPB, type_option_builder: Box<dyn TypeOptionBuilder>) -> Self {
         let field_rev = FieldRevision {
             id: field.id,
             name: field.name,

+ 7 - 7
frontend/rust-lib/flowy-grid/src/services/field/type_options/date_type_option/date_type_option_entities.rs

@@ -1,5 +1,5 @@
-use crate::entities::CellChangeset;
-use crate::entities::{CellIdentifier, CellIdentifierPayload};
+use crate::entities::CellChangesetPB;
+use crate::entities::{CellIdentifierParams, GridCellIdentifierPayloadPB};
 use crate::services::cell::{CellBytesParser, FromCellChangeset, FromCellString};
 use bytes::Bytes;
 
@@ -24,7 +24,7 @@ pub struct DateCellDataPB {
 #[derive(Clone, Debug, Default, ProtoBuf)]
 pub struct DateChangesetPayloadPB {
     #[pb(index = 1)]
-    pub cell_identifier: CellIdentifierPayload,
+    pub cell_identifier: GridCellIdentifierPayloadPB,
 
     #[pb(index = 2, one_of)]
     pub date: Option<String>,
@@ -34,7 +34,7 @@ pub struct DateChangesetPayloadPB {
 }
 
 pub struct DateChangesetParams {
-    pub cell_identifier: CellIdentifier,
+    pub cell_identifier: CellIdentifierParams,
     pub date: Option<String>,
     pub time: Option<String>,
 }
@@ -43,7 +43,7 @@ impl TryInto<DateChangesetParams> for DateChangesetPayloadPB {
     type Error = ErrorCode;
 
     fn try_into(self) -> Result<DateChangesetParams, Self::Error> {
-        let cell_identifier: CellIdentifier = self.cell_identifier.try_into()?;
+        let cell_identifier: CellIdentifierParams = self.cell_identifier.try_into()?;
         Ok(DateChangesetParams {
             cell_identifier,
             date: self.date,
@@ -52,14 +52,14 @@ impl TryInto<DateChangesetParams> for DateChangesetPayloadPB {
     }
 }
 
-impl std::convert::From<DateChangesetParams> for CellChangeset {
+impl std::convert::From<DateChangesetParams> for CellChangesetPB {
     fn from(params: DateChangesetParams) -> Self {
         let changeset = DateCellChangesetPB {
             date: params.date,
             time: params.time,
         };
         let s = serde_json::to_string(&changeset).unwrap();
-        CellChangeset {
+        CellChangesetPB {
             grid_id: params.cell_identifier.grid_id,
             row_id: params.cell_identifier.row_id,
             field_id: params.cell_identifier.field_id,

+ 8 - 8
frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option/select_option.rs

@@ -1,4 +1,4 @@
-use crate::entities::{CellChangeset, CellIdentifier, CellIdentifierPayload, FieldType};
+use crate::entities::{CellChangesetPB, CellIdentifierParams, FieldType, GridCellIdentifierPayloadPB};
 use crate::services::cell::{CellBytes, CellBytesParser, CellData, CellDisplayable, FromCellChangeset, FromCellString};
 use crate::services::field::{MultiSelectTypeOption, SingleSelectTypeOptionPB};
 use bytes::Bytes;
@@ -225,7 +225,7 @@ impl CellBytesParser for SelectOptionCellDataParser {
 #[derive(Clone, Debug, Default, ProtoBuf)]
 pub struct SelectOptionCellChangesetPayloadPB {
     #[pb(index = 1)]
-    pub cell_identifier: CellIdentifierPayload,
+    pub cell_identifier: GridCellIdentifierPayloadPB,
 
     #[pb(index = 2, one_of)]
     pub insert_option_id: Option<String>,
@@ -235,19 +235,19 @@ pub struct SelectOptionCellChangesetPayloadPB {
 }
 
 pub struct SelectOptionCellChangesetParams {
-    pub cell_identifier: CellIdentifier,
+    pub cell_identifier: CellIdentifierParams,
     pub insert_option_id: Option<String>,
     pub delete_option_id: Option<String>,
 }
 
-impl std::convert::From<SelectOptionCellChangesetParams> for CellChangeset {
+impl std::convert::From<SelectOptionCellChangesetParams> for CellChangesetPB {
     fn from(params: SelectOptionCellChangesetParams) -> Self {
         let changeset = SelectOptionCellChangeset {
             insert_option_id: params.insert_option_id,
             delete_option_id: params.delete_option_id,
         };
         let s = serde_json::to_string(&changeset).unwrap();
-        CellChangeset {
+        CellChangesetPB {
             grid_id: params.cell_identifier.grid_id,
             row_id: params.cell_identifier.row_id,
             field_id: params.cell_identifier.field_id,
@@ -260,7 +260,7 @@ impl TryInto<SelectOptionCellChangesetParams> for SelectOptionCellChangesetPaylo
     type Error = ErrorCode;
 
     fn try_into(self) -> Result<SelectOptionCellChangesetParams, Self::Error> {
-        let cell_identifier: CellIdentifier = self.cell_identifier.try_into()?;
+        let cell_identifier: CellIdentifierParams = self.cell_identifier.try_into()?;
         let insert_option_id = match self.insert_option_id {
             None => None,
             Some(insert_option_id) => Some(
@@ -334,7 +334,7 @@ pub struct SelectOptionCellDataPB {
 #[derive(Clone, Debug, Default, ProtoBuf)]
 pub struct SelectOptionChangesetPayloadPB {
     #[pb(index = 1)]
-    pub cell_identifier: CellIdentifierPayload,
+    pub cell_identifier: GridCellIdentifierPayloadPB,
 
     #[pb(index = 2, one_of)]
     pub insert_option: Option<SelectOptionPB>,
@@ -347,7 +347,7 @@ pub struct SelectOptionChangesetPayloadPB {
 }
 
 pub struct SelectOptionChangeset {
-    pub cell_identifier: CellIdentifier,
+    pub cell_identifier: CellIdentifierParams,
     pub insert_option: Option<SelectOptionPB>,
     pub update_option: Option<SelectOptionPB>,
     pub delete_option: Option<SelectOptionPB>,

+ 11 - 11
frontend/rust-lib/flowy-grid/src/services/grid_editor.rs

@@ -1,5 +1,5 @@
 use crate::dart_notification::{send_dart_notification, GridNotification};
-use crate::entities::CellIdentifier;
+use crate::entities::CellIdentifierParams;
 use crate::entities::*;
 use crate::manager::{GridTaskSchedulerRwLock, GridUser};
 use crate::services::block_manager::GridBlockManager;
@@ -188,7 +188,7 @@ impl GridRevisionEditor {
 
     pub async fn delete_field(&self, field_id: &str) -> FlowyResult<()> {
         let _ = self.modify(|grid_pad| Ok(grid_pad.delete_field_rev(field_id)?)).await?;
-        let field_order = GridFieldPB::from(field_id);
+        let field_order = GridFieldIdPB::from(field_id);
         let notified_changeset = GridFieldChangesetPB::delete(&self.grid_id, vec![field_order]);
         let _ = self.notify_did_update_grid(notified_changeset).await?;
         Ok(())
@@ -339,12 +339,12 @@ impl GridRevisionEditor {
         Ok(())
     }
 
-    pub async fn get_cell(&self, params: &CellIdentifier) -> Option<Cell> {
+    pub async fn get_cell(&self, params: &CellIdentifierParams) -> Option<GridCellPB> {
         let cell_bytes = self.get_cell_bytes(params).await?;
-        Some(Cell::new(&params.field_id, cell_bytes.to_vec()))
+        Some(GridCellPB::new(&params.field_id, cell_bytes.to_vec()))
     }
 
-    pub async fn get_cell_bytes(&self, params: &CellIdentifier) -> Option<CellBytes> {
+    pub async fn get_cell_bytes(&self, params: &CellIdentifierParams) -> Option<CellBytes> {
         let field_rev = self.get_field_rev(&params.field_id).await?;
         let row_rev = self.block_manager.get_row_rev(&params.row_id).await.ok()??;
 
@@ -364,12 +364,12 @@ impl GridRevisionEditor {
     }
 
     #[tracing::instrument(level = "trace", skip_all, err)]
-    pub async fn update_cell(&self, cell_changeset: CellChangeset) -> FlowyResult<()> {
+    pub async fn update_cell(&self, cell_changeset: CellChangesetPB) -> FlowyResult<()> {
         if cell_changeset.content.as_ref().is_none() {
             return Ok(());
         }
 
-        let CellChangeset {
+        let CellChangesetPB {
             grid_id,
             row_id,
             field_id,
@@ -387,7 +387,7 @@ impl GridRevisionEditor {
                 let cell_rev = self.get_cell_rev(&row_id, &field_id).await?;
                 // Update the changeset.data property with the return value.
                 content = Some(apply_cell_data_changeset(content.unwrap(), cell_rev, field_rev)?);
-                let cell_changeset = CellChangeset {
+                let cell_changeset = CellChangesetPB {
                     grid_id,
                     row_id,
                     field_id,
@@ -425,7 +425,7 @@ impl GridRevisionEditor {
         let field_orders = pad_read_guard
             .get_field_revs(None)?
             .iter()
-            .map(GridFieldPB::from)
+            .map(GridFieldIdPB::from)
             .collect();
         let mut block_orders = vec![];
         for block_rev in pad_read_guard.get_block_meta_revs() {
@@ -508,7 +508,7 @@ impl GridRevisionEditor {
             .modify(|grid_pad| Ok(grid_pad.move_field(field_id, from as usize, to as usize)?))
             .await?;
         if let Some((index, field_rev)) = self.grid_pad.read().await.get_field_rev(field_id) {
-            let delete_field_order = GridFieldPB::from(field_id);
+            let delete_field_order = GridFieldIdPB::from(field_id);
             let insert_field = IndexFieldPB::from_field_rev(field_rev, index);
             let notified_changeset = GridFieldChangesetPB {
                 grid_id: self.grid_id.clone(),
@@ -615,7 +615,7 @@ impl GridRevisionEditor {
             .get_field_rev(field_id)
             .map(|(index, field)| (index, field.clone()))
         {
-            let updated_field = FieldPB::from(field_rev);
+            let updated_field = GridFieldPB::from(field_rev);
             let notified_changeset = GridFieldChangesetPB::update(&self.grid_id, vec![updated_field.clone()]);
             let _ = self.notify_did_update_grid(notified_changeset).await?;
 

+ 3 - 3
frontend/rust-lib/flowy-grid/tests/grid/block_test/script.rs

@@ -2,7 +2,7 @@ use crate::grid::block_test::script::RowScript::{AssertCell, CreateRow};
 use crate::grid::block_test::util::GridRowTestBuilder;
 use crate::grid::grid_editor::GridEditorTest;
 
-use flowy_grid::entities::{CellIdentifier, FieldType, GridRowPB};
+use flowy_grid::entities::{CellIdentifierParams, FieldType, GridRowPB};
 use flowy_grid::services::field::*;
 use flowy_grid_data_model::revision::{
     GridBlockMetaRevision, GridBlockMetaRevisionChangeset, RowMetaChangeset, RowRevision,
@@ -109,7 +109,7 @@ impl GridRowTest {
                 field_type,
                 expected,
             } => {
-                let id = CellIdentifier {
+                let id = CellIdentifierParams {
                     grid_id: self.grid_id.clone(),
                     field_id,
                     row_id,
@@ -154,7 +154,7 @@ impl GridRowTest {
         }
     }
 
-    async fn compare_cell_content(&self, cell_id: CellIdentifier, field_type: FieldType, expected: String) {
+    async fn compare_cell_content(&self, cell_id: CellIdentifierParams, field_type: FieldType, expected: String) {
         match field_type {
             FieldType::RichText => {
                 let cell_data = self

+ 2 - 2
frontend/rust-lib/flowy-grid/tests/grid/cell_test/script.rs

@@ -1,8 +1,8 @@
 use crate::grid::grid_editor::GridEditorTest;
-use flowy_grid::entities::CellChangeset;
+use flowy_grid::entities::CellChangesetPB;
 
 pub enum CellScript {
-    UpdateCell { changeset: CellChangeset, is_err: bool },
+    UpdateCell { changeset: CellChangesetPB, is_err: bool },
 }
 
 pub struct GridCellTest {

+ 2 - 2
frontend/rust-lib/flowy-grid/tests/grid/cell_test/test.rs

@@ -1,7 +1,7 @@
 use crate::grid::cell_test::script::CellScript::*;
 use crate::grid::cell_test::script::GridCellTest;
 use crate::grid::field_test::util::make_date_cell_string;
-use flowy_grid::entities::{CellChangeset, FieldType};
+use flowy_grid::entities::{CellChangesetPB, FieldType};
 use flowy_grid::services::field::selection_type_option::SelectOptionCellChangeset;
 use flowy_grid::services::field::{MultiSelectTypeOption, SingleSelectTypeOptionPB};
 
@@ -36,7 +36,7 @@ async fn grid_cell_update() {
             };
 
             scripts.push(UpdateCell {
-                changeset: CellChangeset {
+                changeset: CellChangesetPB {
                     grid_id: block_id.to_string(),
                     row_id: row_rev.id.clone(),
                     field_id: field_rev.id.clone(),

+ 2 - 2
frontend/rust-lib/flowy-grid/tests/grid/field_test/util.rs

@@ -17,7 +17,7 @@ pub fn create_text_field(grid_id: &str) -> (InsertFieldParams, FieldRevision) {
         .protobuf_bytes()
         .to_vec();
 
-    let field = FieldPB {
+    let field = GridFieldPB {
         id: field_rev.id,
         name: field_rev.name,
         desc: field_rev.desc,
@@ -50,7 +50,7 @@ pub fn create_single_select_field(grid_id: &str) -> (InsertFieldParams, FieldRev
         .protobuf_bytes()
         .to_vec();
 
-    let field = FieldPB {
+    let field = GridFieldPB {
         id: field_rev.id,
         name: field_rev.name,
         desc: field_rev.desc,