Forráskód Böngészése

chore: add date cell handler

appflowy 3 éve
szülő
commit
19da42f210
38 módosított fájl, 993 hozzáadás és 506 törlés
  1. 1 1
      frontend/app_flowy/lib/workspace/application/grid/cell/cell_service.dart
  2. 3 1
      frontend/app_flowy/lib/workspace/application/grid/cell/date_cal_bloc.dart
  3. 12 18
      frontend/app_flowy/lib/workspace/application/grid/cell/select_option_service.dart
  4. 2 1
      frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/date_cell/calendar.dart
  5. 20 3
      frontend/app_flowy/packages/flowy_sdk/lib/dispatch/dart_event/flowy-grid/dart_event.dart
  6. 15 15
      frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid.pb.dart
  7. 3 3
      frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid.pbjson.dart
  8. 105 0
      frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/date_type_option.pb.dart
  9. 16 0
      frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/date_type_option.pbjson.dart
  10. 4 2
      frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/event_map.pbenum.dart
  11. 3 2
      frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/event_map.pbjson.dart
  12. 24 50
      frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/selection_type_option.pb.dart
  13. 4 6
      frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/selection_type_option.pbjson.dart
  14. 20 10
      frontend/rust-lib/flowy-grid/src/event_handler.rs
  15. 7 2
      frontend/rust-lib/flowy-grid/src/event_map.rs
  16. 348 7
      frontend/rust-lib/flowy-grid/src/protobuf/model/date_type_option.rs
  17. 9 5
      frontend/rust-lib/flowy-grid/src/protobuf/model/event_map.rs
  18. 54 124
      frontend/rust-lib/flowy-grid/src/protobuf/model/selection_type_option.rs
  19. 6 0
      frontend/rust-lib/flowy-grid/src/protobuf/proto/date_type_option.proto
  20. 2 1
      frontend/rust-lib/flowy-grid/src/protobuf/proto/event_map.proto
  21. 3 5
      frontend/rust-lib/flowy-grid/src/protobuf/proto/selection_type_option.proto
  22. 9 9
      frontend/rust-lib/flowy-grid/src/services/field/type_options/checkbox_type_option.rs
  23. 74 15
      frontend/rust-lib/flowy-grid/src/services/field/type_options/date_type_option.rs
  24. 1 1
      frontend/rust-lib/flowy-grid/src/services/field/type_options/mod.rs
  25. 36 25
      frontend/rust-lib/flowy-grid/src/services/field/type_options/number_type_option.rs
  26. 73 88
      frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option.rs
  27. 12 9
      frontend/rust-lib/flowy-grid/src/services/field/type_options/text_type_option.rs
  28. 0 1
      frontend/rust-lib/flowy-grid/src/services/field/type_options/type_option_data.rs
  29. 10 0
      frontend/rust-lib/flowy-grid/src/services/field/type_options/util.rs
  30. 29 14
      frontend/rust-lib/flowy-grid/src/services/grid_editor.rs
  31. 31 34
      frontend/rust-lib/flowy-grid/src/services/row/cell_data_operation.rs
  32. 2 2
      frontend/rust-lib/flowy-grid/src/services/row/row_builder.rs
  33. 2 2
      frontend/rust-lib/flowy-grid/src/services/row/row_loader.rs
  34. 8 7
      frontend/rust-lib/flowy-grid/tests/grid/grid_test.rs
  35. 2 2
      shared-lib/flowy-grid-data-model/src/entities/grid.rs
  36. 41 40
      shared-lib/flowy-grid-data-model/src/protobuf/model/grid.rs
  37. 1 1
      shared-lib/flowy-grid-data-model/src/protobuf/proto/grid.proto
  38. 1 0
      shared-lib/flowy-user-data-model/src/parser/user_email.rs

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

@@ -344,7 +344,7 @@ class CellService {
       ..gridId = gridId
       ..fieldId = fieldId
       ..rowId = rowId
-      ..data = data;
+      ..cellContentChangeset = data;
     return GridEventUpdateCell(payload).send();
   }
 

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

@@ -51,7 +51,9 @@ class DateCalBloc extends Bloc<DateCalEvent, DateCalState> {
           setTimeFormat: (_TimeFormat value) async {
             await _updateTypeOption(emit, timeFormat: value.timeFormat);
           },
-          setTime: (_Time value) {},
+          setTime: (_Time value) {
+            //
+          },
         );
       },
     );

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

@@ -60,27 +60,18 @@ class SelectOptionService {
   Future<Either<Unit, FlowyError>> update({
     required SelectOption option,
   }) {
-    final cellIdentifier = CellIdentifierPayload.create()
-      ..gridId = gridId
-      ..fieldId = fieldId
-      ..rowId = rowId;
     final payload = SelectOptionChangesetPayload.create()
       ..updateOption = option
-      ..cellIdentifier = cellIdentifier;
+      ..cellIdentifier = _cellIdentifier();
     return GridEventUpdateSelectOption(payload).send();
   }
 
   Future<Either<Unit, FlowyError>> delete({
     required SelectOption option,
   }) {
-    final cellIdentifier = CellIdentifierPayload.create()
-      ..gridId = gridId
-      ..fieldId = fieldId
-      ..rowId = rowId;
-
     final payload = SelectOptionChangesetPayload.create()
       ..deleteOption = option
-      ..cellIdentifier = cellIdentifier;
+      ..cellIdentifier = _cellIdentifier();
 
     return GridEventUpdateSelectOption(payload).send();
   }
@@ -96,19 +87,22 @@ class SelectOptionService {
 
   Future<Either<void, FlowyError>> select({required String optionId}) {
     final payload = SelectOptionCellChangesetPayload.create()
-      ..gridId = gridId
-      ..fieldId = fieldId
-      ..rowId = rowId
+      ..cellIdentifier = _cellIdentifier()
       ..insertOptionId = optionId;
-    return GridEventUpdateCellSelectOption(payload).send();
+    return GridEventUpdateSelectOptionCell(payload).send();
   }
 
   Future<Either<void, FlowyError>> unSelect({required String optionId}) {
     final payload = SelectOptionCellChangesetPayload.create()
+      ..cellIdentifier = _cellIdentifier()
+      ..deleteOptionId = optionId;
+    return GridEventUpdateSelectOptionCell(payload).send();
+  }
+
+  CellIdentifierPayload _cellIdentifier() {
+    return CellIdentifierPayload.create()
       ..gridId = gridId
       ..fieldId = fieldId
-      ..rowId = rowId
-      ..deleteOptionId = optionId;
-    return GridEventUpdateCellSelectOption(payload).send();
+      ..rowId = rowId;
   }
 }

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

@@ -309,6 +309,7 @@ class _CalDateTimeSetting extends StatefulWidget {
       identifier: _CalDateTimeSetting.identifier(),
       anchorContext: context,
       anchorDirection: AnchorDirection.rightWithCenterAligned,
+      anchorOffset: const Offset(20, 0),
     );
   }
 }
@@ -369,7 +370,7 @@ class _CalDateTimeSettingState extends State<_CalDateTimeSetting> {
       anchorContext: context,
       anchorDirection: AnchorDirection.rightWithCenterAligned,
       style: FlowyOverlayStyle(blur: false),
-      anchorOffset: const Offset(-20, 0),
+      anchorOffset: const Offset(20, 0),
     );
   }
 }

+ 20 - 3
frontend/app_flowy/packages/flowy_sdk/lib/dispatch/dart_event/flowy-grid/dart_event.dart

@@ -358,13 +358,30 @@ class GridEventUpdateCell {
     }
 }
 
-class GridEventUpdateCellSelectOption {
+class GridEventUpdateSelectOptionCell {
      SelectOptionCellChangesetPayload request;
-     GridEventUpdateCellSelectOption(this.request);
+     GridEventUpdateSelectOptionCell(this.request);
 
     Future<Either<Unit, FlowyError>> send() {
     final request = FFIRequest.create()
-          ..event = GridEvent.UpdateCellSelectOption.toString()
+          ..event = GridEvent.UpdateSelectOptionCell.toString()
+          ..payload = requestToBytes(this.request);
+
+    return Dispatch.asyncRequest(request)
+        .then((bytesResult) => bytesResult.fold(
+           (bytes) => left(unit),
+           (errBytes) => right(FlowyError.fromBuffer(errBytes)),
+        ));
+    }
+}
+
+class GridEventUpdateDateCell {
+     DateChangesetPayload request;
+     GridEventUpdateDateCell(this.request);
+
+    Future<Either<Unit, FlowyError>> send() {
+    final request = FFIRequest.create()
+          ..event = GridEvent.UpdateDateCell.toString()
           ..payload = requestToBytes(this.request);
 
     return Dispatch.asyncRequest(request)

+ 15 - 15
frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid.pb.dart

@@ -2327,22 +2327,22 @@ class MoveItemPayload extends $pb.GeneratedMessage {
   void clearTy() => clearField(5);
 }
 
-enum CellChangeset_OneOfData {
-  data, 
+enum CellChangeset_OneOfCellContentChangeset {
+  cellContentChangeset, 
   notSet
 }
 
 class CellChangeset extends $pb.GeneratedMessage {
-  static const $core.Map<$core.int, CellChangeset_OneOfData> _CellChangeset_OneOfDataByTag = {
-    4 : CellChangeset_OneOfData.data,
-    0 : CellChangeset_OneOfData.notSet
+  static const $core.Map<$core.int, CellChangeset_OneOfCellContentChangeset> _CellChangeset_OneOfCellContentChangesetByTag = {
+    4 : CellChangeset_OneOfCellContentChangeset.cellContentChangeset,
+    0 : CellChangeset_OneOfCellContentChangeset.notSet
   };
   static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'CellChangeset', createEmptyInstance: create)
     ..oo(0, [4])
     ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridId')
     ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'rowId')
     ..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldId')
-    ..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'data')
+    ..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'cellContentChangeset')
     ..hasRequiredFields = false
   ;
 
@@ -2351,7 +2351,7 @@ class CellChangeset extends $pb.GeneratedMessage {
     $core.String? gridId,
     $core.String? rowId,
     $core.String? fieldId,
-    $core.String? data,
+    $core.String? cellContentChangeset,
   }) {
     final _result = create();
     if (gridId != null) {
@@ -2363,8 +2363,8 @@ class CellChangeset extends $pb.GeneratedMessage {
     if (fieldId != null) {
       _result.fieldId = fieldId;
     }
-    if (data != null) {
-      _result.data = data;
+    if (cellContentChangeset != null) {
+      _result.cellContentChangeset = cellContentChangeset;
     }
     return _result;
   }
@@ -2389,8 +2389,8 @@ class CellChangeset extends $pb.GeneratedMessage {
   static CellChangeset getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<CellChangeset>(create);
   static CellChangeset? _defaultInstance;
 
-  CellChangeset_OneOfData whichOneOfData() => _CellChangeset_OneOfDataByTag[$_whichOneof(0)]!;
-  void clearOneOfData() => clearField($_whichOneof(0));
+  CellChangeset_OneOfCellContentChangeset whichOneOfCellContentChangeset() => _CellChangeset_OneOfCellContentChangesetByTag[$_whichOneof(0)]!;
+  void clearOneOfCellContentChangeset() => clearField($_whichOneof(0));
 
   @$pb.TagNumber(1)
   $core.String get gridId => $_getSZ(0);
@@ -2420,12 +2420,12 @@ class CellChangeset extends $pb.GeneratedMessage {
   void clearFieldId() => clearField(3);
 
   @$pb.TagNumber(4)
-  $core.String get data => $_getSZ(3);
+  $core.String get cellContentChangeset => $_getSZ(3);
   @$pb.TagNumber(4)
-  set data($core.String v) { $_setString(3, v); }
+  set cellContentChangeset($core.String v) { $_setString(3, v); }
   @$pb.TagNumber(4)
-  $core.bool hasData() => $_has(3);
+  $core.bool hasCellContentChangeset() => $_has(3);
   @$pb.TagNumber(4)
-  void clearData() => clearField(4);
+  void clearCellContentChangeset() => clearField(4);
 }
 

+ 3 - 3
frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid.pbjson.dart

@@ -449,12 +449,12 @@ const CellChangeset$json = const {
     const {'1': 'grid_id', '3': 1, '4': 1, '5': 9, '10': 'gridId'},
     const {'1': 'row_id', '3': 2, '4': 1, '5': 9, '10': 'rowId'},
     const {'1': 'field_id', '3': 3, '4': 1, '5': 9, '10': 'fieldId'},
-    const {'1': 'data', '3': 4, '4': 1, '5': 9, '9': 0, '10': 'data'},
+    const {'1': 'cell_content_changeset', '3': 4, '4': 1, '5': 9, '9': 0, '10': 'cellContentChangeset'},
   ],
   '8': const [
-    const {'1': 'one_of_data'},
+    const {'1': 'one_of_cell_content_changeset'},
   ],
 };
 
 /// Descriptor for `CellChangeset`. Decode as a `google.protobuf.DescriptorProto`.
-final $typed_data.Uint8List cellChangesetDescriptor = $convert.base64Decode('Cg1DZWxsQ2hhbmdlc2V0EhcKB2dyaWRfaWQYASABKAlSBmdyaWRJZBIVCgZyb3dfaWQYAiABKAlSBXJvd0lkEhkKCGZpZWxkX2lkGAMgASgJUgdmaWVsZElkEhQKBGRhdGEYBCABKAlIAFIEZGF0YUINCgtvbmVfb2ZfZGF0YQ==');
+final $typed_data.Uint8List cellChangesetDescriptor = $convert.base64Decode('Cg1DZWxsQ2hhbmdlc2V0EhcKB2dyaWRfaWQYASABKAlSBmdyaWRJZBIVCgZyb3dfaWQYAiABKAlSBXJvd0lkEhkKCGZpZWxkX2lkGAMgASgJUgdmaWVsZElkEjYKFmNlbGxfY29udGVudF9jaGFuZ2VzZXQYBCABKAlIAFIUY2VsbENvbnRlbnRDaGFuZ2VzZXRCHwodb25lX29mX2NlbGxfY29udGVudF9jaGFuZ2VzZXQ=');

+ 105 - 0
frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/date_type_option.pb.dart

@@ -9,6 +9,8 @@ import 'dart:core' as $core;
 
 import 'package:protobuf/protobuf.dart' as $pb;
 
+import 'cell_entities.pb.dart' as $0;
+
 import 'date_type_option.pbenum.dart';
 
 export 'date_type_option.pbenum.dart';
@@ -88,3 +90,106 @@ class DateTypeOption extends $pb.GeneratedMessage {
   void clearIncludeTime() => clearField(3);
 }
 
+enum DateChangesetPayload_OneOfDate {
+  date, 
+  notSet
+}
+
+enum DateChangesetPayload_OneOfTime {
+  time, 
+  notSet
+}
+
+class DateChangesetPayload extends $pb.GeneratedMessage {
+  static const $core.Map<$core.int, DateChangesetPayload_OneOfDate> _DateChangesetPayload_OneOfDateByTag = {
+    2 : DateChangesetPayload_OneOfDate.date,
+    0 : DateChangesetPayload_OneOfDate.notSet
+  };
+  static const $core.Map<$core.int, DateChangesetPayload_OneOfTime> _DateChangesetPayload_OneOfTimeByTag = {
+    3 : DateChangesetPayload_OneOfTime.time,
+    0 : DateChangesetPayload_OneOfTime.notSet
+  };
+  static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'DateChangesetPayload', createEmptyInstance: create)
+    ..oo(0, [2])
+    ..oo(1, [3])
+    ..aOM<$0.CellIdentifierPayload>(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'cellIdentifier', subBuilder: $0.CellIdentifierPayload.create)
+    ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'date')
+    ..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'time')
+    ..hasRequiredFields = false
+  ;
+
+  DateChangesetPayload._() : super();
+  factory DateChangesetPayload({
+    $0.CellIdentifierPayload? cellIdentifier,
+    $core.String? date,
+    $core.String? time,
+  }) {
+    final _result = create();
+    if (cellIdentifier != null) {
+      _result.cellIdentifier = cellIdentifier;
+    }
+    if (date != null) {
+      _result.date = date;
+    }
+    if (time != null) {
+      _result.time = time;
+    }
+    return _result;
+  }
+  factory DateChangesetPayload.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
+  factory DateChangesetPayload.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
+  @$core.Deprecated(
+  'Using this can add significant overhead to your binary. '
+  'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
+  'Will be removed in next major version')
+  DateChangesetPayload clone() => DateChangesetPayload()..mergeFromMessage(this);
+  @$core.Deprecated(
+  'Using this can add significant overhead to your binary. '
+  'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
+  'Will be removed in next major version')
+  DateChangesetPayload copyWith(void Function(DateChangesetPayload) updates) => super.copyWith((message) => updates(message as DateChangesetPayload)) as DateChangesetPayload; // ignore: deprecated_member_use
+  $pb.BuilderInfo get info_ => _i;
+  @$core.pragma('dart2js:noInline')
+  static DateChangesetPayload create() => DateChangesetPayload._();
+  DateChangesetPayload createEmptyInstance() => create();
+  static $pb.PbList<DateChangesetPayload> createRepeated() => $pb.PbList<DateChangesetPayload>();
+  @$core.pragma('dart2js:noInline')
+  static DateChangesetPayload getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<DateChangesetPayload>(create);
+  static DateChangesetPayload? _defaultInstance;
+
+  DateChangesetPayload_OneOfDate whichOneOfDate() => _DateChangesetPayload_OneOfDateByTag[$_whichOneof(0)]!;
+  void clearOneOfDate() => clearField($_whichOneof(0));
+
+  DateChangesetPayload_OneOfTime whichOneOfTime() => _DateChangesetPayload_OneOfTimeByTag[$_whichOneof(1)]!;
+  void clearOneOfTime() => clearField($_whichOneof(1));
+
+  @$pb.TagNumber(1)
+  $0.CellIdentifierPayload get cellIdentifier => $_getN(0);
+  @$pb.TagNumber(1)
+  set cellIdentifier($0.CellIdentifierPayload v) { setField(1, v); }
+  @$pb.TagNumber(1)
+  $core.bool hasCellIdentifier() => $_has(0);
+  @$pb.TagNumber(1)
+  void clearCellIdentifier() => clearField(1);
+  @$pb.TagNumber(1)
+  $0.CellIdentifierPayload ensureCellIdentifier() => $_ensure(0);
+
+  @$pb.TagNumber(2)
+  $core.String get date => $_getSZ(1);
+  @$pb.TagNumber(2)
+  set date($core.String v) { $_setString(1, v); }
+  @$pb.TagNumber(2)
+  $core.bool hasDate() => $_has(1);
+  @$pb.TagNumber(2)
+  void clearDate() => clearField(2);
+
+  @$pb.TagNumber(3)
+  $core.String get time => $_getSZ(2);
+  @$pb.TagNumber(3)
+  set time($core.String v) { $_setString(2, v); }
+  @$pb.TagNumber(3)
+  $core.bool hasTime() => $_has(2);
+  @$pb.TagNumber(3)
+  void clearTime() => clearField(3);
+}
+

+ 16 - 0
frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/date_type_option.pbjson.dart

@@ -44,3 +44,19 @@ const DateTypeOption$json = const {
 
 /// Descriptor for `DateTypeOption`. Decode as a `google.protobuf.DescriptorProto`.
 final $typed_data.Uint8List dateTypeOptionDescriptor = $convert.base64Decode('Cg5EYXRlVHlwZU9wdGlvbhIsCgtkYXRlX2Zvcm1hdBgBIAEoDjILLkRhdGVGb3JtYXRSCmRhdGVGb3JtYXQSLAoLdGltZV9mb3JtYXQYAiABKA4yCy5UaW1lRm9ybWF0Ugp0aW1lRm9ybWF0EiEKDGluY2x1ZGVfdGltZRgDIAEoCFILaW5jbHVkZVRpbWU=');
+@$core.Deprecated('Use dateChangesetPayloadDescriptor instead')
+const DateChangesetPayload$json = const {
+  '1': 'DateChangesetPayload',
+  '2': const [
+    const {'1': 'cell_identifier', '3': 1, '4': 1, '5': 11, '6': '.CellIdentifierPayload', '10': 'cellIdentifier'},
+    const {'1': 'date', '3': 2, '4': 1, '5': 9, '9': 0, '10': 'date'},
+    const {'1': 'time', '3': 3, '4': 1, '5': 9, '9': 1, '10': 'time'},
+  ],
+  '8': const [
+    const {'1': 'one_of_date'},
+    const {'1': 'one_of_time'},
+  ],
+};
+
+/// Descriptor for `DateChangesetPayload`. Decode as a `google.protobuf.DescriptorProto`.
+final $typed_data.Uint8List dateChangesetPayloadDescriptor = $convert.base64Decode('ChREYXRlQ2hhbmdlc2V0UGF5bG9hZBI/Cg9jZWxsX2lkZW50aWZpZXIYASABKAsyFi5DZWxsSWRlbnRpZmllclBheWxvYWRSDmNlbGxJZGVudGlmaWVyEhQKBGRhdGUYAiABKAlIAFIEZGF0ZRIUCgR0aW1lGAMgASgJSAFSBHRpbWVCDQoLb25lX29mX2RhdGVCDQoLb25lX29mX3RpbWU=');

+ 4 - 2
frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/event_map.pbenum.dart

@@ -31,7 +31,8 @@ class GridEvent extends $pb.ProtobufEnum {
   static const GridEvent DuplicateRow = GridEvent._(53, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'DuplicateRow');
   static const GridEvent GetCell = GridEvent._(70, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'GetCell');
   static const GridEvent UpdateCell = GridEvent._(71, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'UpdateCell');
-  static const GridEvent UpdateCellSelectOption = GridEvent._(72, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'UpdateCellSelectOption');
+  static const GridEvent UpdateSelectOptionCell = GridEvent._(72, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'UpdateSelectOptionCell');
+  static const GridEvent UpdateDateCell = GridEvent._(80, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'UpdateDateCell');
 
   static const $core.List<GridEvent> values = <GridEvent> [
     GetGridData,
@@ -55,7 +56,8 @@ class GridEvent extends $pb.ProtobufEnum {
     DuplicateRow,
     GetCell,
     UpdateCell,
-    UpdateCellSelectOption,
+    UpdateSelectOptionCell,
+    UpdateDateCell,
   ];
 
   static final $core.Map<$core.int, GridEvent> _byValue = $pb.ProtobufEnum.initByValue(values);

+ 3 - 2
frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/event_map.pbjson.dart

@@ -33,9 +33,10 @@ const GridEvent$json = const {
     const {'1': 'DuplicateRow', '2': 53},
     const {'1': 'GetCell', '2': 70},
     const {'1': 'UpdateCell', '2': 71},
-    const {'1': 'UpdateCellSelectOption', '2': 72},
+    const {'1': 'UpdateSelectOptionCell', '2': 72},
+    const {'1': 'UpdateDateCell', '2': 80},
   ],
 };
 
 /// Descriptor for `GridEvent`. Decode as a `google.protobuf.EnumDescriptorProto`.
-final $typed_data.Uint8List gridEventDescriptor = $convert.base64Decode('CglHcmlkRXZlbnQSDwoLR2V0R3JpZERhdGEQABIRCg1HZXRHcmlkQmxvY2tzEAESDQoJR2V0RmllbGRzEAoSDwoLVXBkYXRlRmllbGQQCxIZChVVcGRhdGVGaWVsZFR5cGVPcHRpb24QDBIPCgtJbnNlcnRGaWVsZBANEg8KC0RlbGV0ZUZpZWxkEA4SEQoNU3dpdGNoVG9GaWVsZBAUEhIKDkR1cGxpY2F0ZUZpZWxkEBUSFwoTR2V0RWRpdEZpZWxkQ29udGV4dBAWEgwKCE1vdmVJdGVtEBcSFgoSR2V0RmllbGRUeXBlT3B0aW9uEBgSEwoPTmV3U2VsZWN0T3B0aW9uEB4SGgoWR2V0U2VsZWN0T3B0aW9uQ29udGV4dBAfEhYKElVwZGF0ZVNlbGVjdE9wdGlvbhAgEg0KCUNyZWF0ZVJvdxAyEgoKBkdldFJvdxAzEg0KCURlbGV0ZVJvdxA0EhAKDER1cGxpY2F0ZVJvdxA1EgsKB0dldENlbGwQRhIOCgpVcGRhdGVDZWxsEEcSGgoWVXBkYXRlQ2VsbFNlbGVjdE9wdGlvbhBI');
+final $typed_data.Uint8List gridEventDescriptor = $convert.base64Decode('CglHcmlkRXZlbnQSDwoLR2V0R3JpZERhdGEQABIRCg1HZXRHcmlkQmxvY2tzEAESDQoJR2V0RmllbGRzEAoSDwoLVXBkYXRlRmllbGQQCxIZChVVcGRhdGVGaWVsZFR5cGVPcHRpb24QDBIPCgtJbnNlcnRGaWVsZBANEg8KC0RlbGV0ZUZpZWxkEA4SEQoNU3dpdGNoVG9GaWVsZBAUEhIKDkR1cGxpY2F0ZUZpZWxkEBUSFwoTR2V0RWRpdEZpZWxkQ29udGV4dBAWEgwKCE1vdmVJdGVtEBcSFgoSR2V0RmllbGRUeXBlT3B0aW9uEBgSEwoPTmV3U2VsZWN0T3B0aW9uEB4SGgoWR2V0U2VsZWN0T3B0aW9uQ29udGV4dBAfEhYKElVwZGF0ZVNlbGVjdE9wdGlvbhAgEg0KCUNyZWF0ZVJvdxAyEgoKBkdldFJvdxAzEg0KCURlbGV0ZVJvdxA0EhAKDER1cGxpY2F0ZVJvdxA1EgsKB0dldENlbGwQRhIOCgpVcGRhdGVDZWxsEEcSGgoWVXBkYXRlU2VsZWN0T3B0aW9uQ2VsbBBIEhIKDlVwZGF0ZURhdGVDZWxsEFA=');

+ 24 - 50
frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/selection_type_option.pb.dart

@@ -348,41 +348,31 @@ enum SelectOptionCellChangesetPayload_OneOfDeleteOptionId {
 
 class SelectOptionCellChangesetPayload extends $pb.GeneratedMessage {
   static const $core.Map<$core.int, SelectOptionCellChangesetPayload_OneOfInsertOptionId> _SelectOptionCellChangesetPayload_OneOfInsertOptionIdByTag = {
-    4 : SelectOptionCellChangesetPayload_OneOfInsertOptionId.insertOptionId,
+    2 : SelectOptionCellChangesetPayload_OneOfInsertOptionId.insertOptionId,
     0 : SelectOptionCellChangesetPayload_OneOfInsertOptionId.notSet
   };
   static const $core.Map<$core.int, SelectOptionCellChangesetPayload_OneOfDeleteOptionId> _SelectOptionCellChangesetPayload_OneOfDeleteOptionIdByTag = {
-    5 : SelectOptionCellChangesetPayload_OneOfDeleteOptionId.deleteOptionId,
+    3 : SelectOptionCellChangesetPayload_OneOfDeleteOptionId.deleteOptionId,
     0 : SelectOptionCellChangesetPayload_OneOfDeleteOptionId.notSet
   };
   static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'SelectOptionCellChangesetPayload', createEmptyInstance: create)
-    ..oo(0, [4])
-    ..oo(1, [5])
-    ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridId')
-    ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'rowId')
-    ..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldId')
-    ..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'insertOptionId')
-    ..aOS(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'deleteOptionId')
+    ..oo(0, [2])
+    ..oo(1, [3])
+    ..aOM<$0.CellIdentifierPayload>(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'cellIdentifier', subBuilder: $0.CellIdentifierPayload.create)
+    ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'insertOptionId')
+    ..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'deleteOptionId')
     ..hasRequiredFields = false
   ;
 
   SelectOptionCellChangesetPayload._() : super();
   factory SelectOptionCellChangesetPayload({
-    $core.String? gridId,
-    $core.String? rowId,
-    $core.String? fieldId,
+    $0.CellIdentifierPayload? cellIdentifier,
     $core.String? insertOptionId,
     $core.String? deleteOptionId,
   }) {
     final _result = create();
-    if (gridId != null) {
-      _result.gridId = gridId;
-    }
-    if (rowId != null) {
-      _result.rowId = rowId;
-    }
-    if (fieldId != null) {
-      _result.fieldId = fieldId;
+    if (cellIdentifier != null) {
+      _result.cellIdentifier = cellIdentifier;
     }
     if (insertOptionId != null) {
       _result.insertOptionId = insertOptionId;
@@ -420,49 +410,33 @@ class SelectOptionCellChangesetPayload extends $pb.GeneratedMessage {
   void clearOneOfDeleteOptionId() => clearField($_whichOneof(1));
 
   @$pb.TagNumber(1)
-  $core.String get gridId => $_getSZ(0);
+  $0.CellIdentifierPayload get cellIdentifier => $_getN(0);
   @$pb.TagNumber(1)
-  set gridId($core.String v) { $_setString(0, v); }
+  set cellIdentifier($0.CellIdentifierPayload v) { setField(1, v); }
   @$pb.TagNumber(1)
-  $core.bool hasGridId() => $_has(0);
+  $core.bool hasCellIdentifier() => $_has(0);
+  @$pb.TagNumber(1)
+  void clearCellIdentifier() => clearField(1);
   @$pb.TagNumber(1)
-  void clearGridId() => clearField(1);
+  $0.CellIdentifierPayload ensureCellIdentifier() => $_ensure(0);
 
   @$pb.TagNumber(2)
-  $core.String get rowId => $_getSZ(1);
+  $core.String get insertOptionId => $_getSZ(1);
   @$pb.TagNumber(2)
-  set rowId($core.String v) { $_setString(1, v); }
+  set insertOptionId($core.String v) { $_setString(1, v); }
   @$pb.TagNumber(2)
-  $core.bool hasRowId() => $_has(1);
+  $core.bool hasInsertOptionId() => $_has(1);
   @$pb.TagNumber(2)
-  void clearRowId() => clearField(2);
+  void clearInsertOptionId() => clearField(2);
 
   @$pb.TagNumber(3)
-  $core.String get fieldId => $_getSZ(2);
+  $core.String get deleteOptionId => $_getSZ(2);
   @$pb.TagNumber(3)
-  set fieldId($core.String v) { $_setString(2, v); }
+  set deleteOptionId($core.String v) { $_setString(2, v); }
   @$pb.TagNumber(3)
-  $core.bool hasFieldId() => $_has(2);
+  $core.bool hasDeleteOptionId() => $_has(2);
   @$pb.TagNumber(3)
-  void clearFieldId() => clearField(3);
-
-  @$pb.TagNumber(4)
-  $core.String get insertOptionId => $_getSZ(3);
-  @$pb.TagNumber(4)
-  set insertOptionId($core.String v) { $_setString(3, v); }
-  @$pb.TagNumber(4)
-  $core.bool hasInsertOptionId() => $_has(3);
-  @$pb.TagNumber(4)
-  void clearInsertOptionId() => clearField(4);
-
-  @$pb.TagNumber(5)
-  $core.String get deleteOptionId => $_getSZ(4);
-  @$pb.TagNumber(5)
-  set deleteOptionId($core.String v) { $_setString(4, v); }
-  @$pb.TagNumber(5)
-  $core.bool hasDeleteOptionId() => $_has(4);
-  @$pb.TagNumber(5)
-  void clearDeleteOptionId() => clearField(5);
+  void clearDeleteOptionId() => clearField(3);
 }
 
 class SelectOptionContext extends $pb.GeneratedMessage {

+ 4 - 6
frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/selection_type_option.pbjson.dart

@@ -82,11 +82,9 @@ final $typed_data.Uint8List selectOptionChangesetPayloadDescriptor = $convert.ba
 const SelectOptionCellChangesetPayload$json = const {
   '1': 'SelectOptionCellChangesetPayload',
   '2': const [
-    const {'1': 'grid_id', '3': 1, '4': 1, '5': 9, '10': 'gridId'},
-    const {'1': 'row_id', '3': 2, '4': 1, '5': 9, '10': 'rowId'},
-    const {'1': 'field_id', '3': 3, '4': 1, '5': 9, '10': 'fieldId'},
-    const {'1': 'insert_option_id', '3': 4, '4': 1, '5': 9, '9': 0, '10': 'insertOptionId'},
-    const {'1': 'delete_option_id', '3': 5, '4': 1, '5': 9, '9': 1, '10': 'deleteOptionId'},
+    const {'1': 'cell_identifier', '3': 1, '4': 1, '5': 11, '6': '.CellIdentifierPayload', '10': 'cellIdentifier'},
+    const {'1': 'insert_option_id', '3': 2, '4': 1, '5': 9, '9': 0, '10': 'insertOptionId'},
+    const {'1': 'delete_option_id', '3': 3, '4': 1, '5': 9, '9': 1, '10': 'deleteOptionId'},
   ],
   '8': const [
     const {'1': 'one_of_insert_option_id'},
@@ -95,7 +93,7 @@ const SelectOptionCellChangesetPayload$json = const {
 };
 
 /// Descriptor for `SelectOptionCellChangesetPayload`. Decode as a `google.protobuf.DescriptorProto`.
-final $typed_data.Uint8List selectOptionCellChangesetPayloadDescriptor = $convert.base64Decode('CiBTZWxlY3RPcHRpb25DZWxsQ2hhbmdlc2V0UGF5bG9hZBIXCgdncmlkX2lkGAEgASgJUgZncmlkSWQSFQoGcm93X2lkGAIgASgJUgVyb3dJZBIZCghmaWVsZF9pZBgDIAEoCVIHZmllbGRJZBIqChBpbnNlcnRfb3B0aW9uX2lkGAQgASgJSABSDmluc2VydE9wdGlvbklkEioKEGRlbGV0ZV9vcHRpb25faWQYBSABKAlIAVIOZGVsZXRlT3B0aW9uSWRCGQoXb25lX29mX2luc2VydF9vcHRpb25faWRCGQoXb25lX29mX2RlbGV0ZV9vcHRpb25faWQ=');
+final $typed_data.Uint8List selectOptionCellChangesetPayloadDescriptor = $convert.base64Decode('CiBTZWxlY3RPcHRpb25DZWxsQ2hhbmdlc2V0UGF5bG9hZBI/Cg9jZWxsX2lkZW50aWZpZXIYASABKAsyFi5DZWxsSWRlbnRpZmllclBheWxvYWRSDmNlbGxJZGVudGlmaWVyEioKEGluc2VydF9vcHRpb25faWQYAiABKAlIAFIOaW5zZXJ0T3B0aW9uSWQSKgoQZGVsZXRlX29wdGlvbl9pZBgDIAEoCUgBUg5kZWxldGVPcHRpb25JZEIZChdvbmVfb2ZfaW5zZXJ0X29wdGlvbl9pZEIZChdvbmVfb2ZfZGVsZXRlX29wdGlvbl9pZA==');
 @$core.Deprecated('Use selectOptionContextDescriptor instead')
 const SelectOptionContext$json = const {
   '1': 'SelectOptionContext',

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

@@ -182,8 +182,8 @@ async fn make_edit_field_context(
 
 async fn get_type_option_data(field_meta: &FieldMeta, field_type: &FieldType) -> FlowyResult<Vec<u8>> {
     let s = field_meta
-        .get_type_option_str(&field_type)
-        .unwrap_or_else(|| default_type_option_builder_from_type(&field_type).entry().json_str());
+        .get_type_option_str(field_type)
+        .unwrap_or_else(|| default_type_option_builder_from_type(field_type).entry().json_str());
     let builder = type_option_builder_from_json_str(&s, &field_meta.field_type);
     let type_option_data = builder.entry().protobuf_bytes().to_vec();
 
@@ -301,10 +301,10 @@ pub(crate) async fn update_select_option_handler(
 
     if let Some(mut field_meta) = editor.get_field_meta(&changeset.cell_identifier.field_id).await {
         let mut type_option = select_option_operation(&field_meta)?;
-        let mut cell_data = None;
+        let mut cell_content_changeset = None;
 
         if let Some(option) = changeset.insert_option {
-            cell_data = Some(SelectOptionCellChangeset::from_insert(&option.id).cell_data());
+            cell_content_changeset = Some(SelectOptionCellContentChangeset::from_insert(&option.id).to_str());
             type_option.insert_option(option);
         }
 
@@ -313,7 +313,7 @@ pub(crate) async fn update_select_option_handler(
         }
 
         if let Some(option) = changeset.delete_option {
-            cell_data = Some(SelectOptionCellChangeset::from_delete(&option.id).cell_data());
+            cell_content_changeset = Some(SelectOptionCellContentChangeset::from_delete(&option.id).to_str());
             type_option.delete_option(option);
         }
 
@@ -324,7 +324,7 @@ pub(crate) async fn update_select_option_handler(
             grid_id: changeset.cell_identifier.grid_id,
             row_id: changeset.cell_identifier.row_id,
             field_id: changeset.cell_identifier.field_id,
-            data: cell_data,
+            cell_content_changeset,
         };
         let _ = editor.update_cell(changeset).await?;
     }
@@ -365,13 +365,23 @@ pub(crate) async fn get_select_option_handler(
 }
 
 #[tracing::instrument(level = "debug", skip_all, err)]
-pub(crate) async fn update_cell_select_option_handler(
+pub(crate) async fn update_select_option_cell_handler(
     data: Data<SelectOptionCellChangesetPayload>,
     manager: AppData<Arc<GridManager>>,
 ) -> Result<(), FlowyError> {
     let params: SelectOptionCellChangesetParams = data.into_inner().try_into()?;
-    let editor = manager.get_grid_editor(&params.grid_id)?;
-    let changeset: CellChangeset = params.into();
-    let _ = editor.update_cell(changeset).await?;
+    let editor = manager.get_grid_editor(&params.cell_identifier.grid_id)?;
+    let _ = editor.update_cell(params.into()).await?;
+    Ok(())
+}
+
+#[tracing::instrument(level = "debug", skip_all, err)]
+pub(crate) async fn update_date_cell_handler(
+    data: Data<DateChangesetPayload>,
+    manager: AppData<Arc<GridManager>>,
+) -> Result<(), FlowyError> {
+    let params: DateChangesetParams = data.into_inner().try_into()?;
+    let editor = manager.get_grid_editor(&params.cell_identifier.grid_id)?;
+    let _ = editor.update_cell(params.into()).await?;
     Ok(())
 }

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

@@ -33,7 +33,9 @@ pub fn create(grid_manager: Arc<GridManager>) -> Module {
         .event(GridEvent::NewSelectOption, new_select_option_handler)
         .event(GridEvent::UpdateSelectOption, update_select_option_handler)
         .event(GridEvent::GetSelectOptionContext, get_select_option_handler)
-        .event(GridEvent::UpdateCellSelectOption, update_cell_select_option_handler);
+        .event(GridEvent::UpdateSelectOptionCell, update_select_option_cell_handler)
+        // Date
+        .event(GridEvent::UpdateDateCell, update_date_cell_handler);
 
     module
 }
@@ -105,5 +107,8 @@ pub enum GridEvent {
     UpdateCell = 71,
 
     #[event(input = "SelectOptionCellChangesetPayload")]
-    UpdateCellSelectOption = 72,
+    UpdateSelectOptionCell = 72,
+
+    #[event(input = "DateChangesetPayload")]
+    UpdateDateCell = 80,
 }

+ 348 - 7
frontend/rust-lib/flowy-grid/src/protobuf/model/date_type_option.rs

@@ -237,6 +237,343 @@ impl ::protobuf::reflect::ProtobufValue for DateTypeOption {
     }
 }
 
+#[derive(PartialEq,Clone,Default)]
+pub struct DateChangesetPayload {
+    // message fields
+    pub cell_identifier: ::protobuf::SingularPtrField<super::cell_entities::CellIdentifierPayload>,
+    // message oneof groups
+    pub one_of_date: ::std::option::Option<DateChangesetPayload_oneof_one_of_date>,
+    pub one_of_time: ::std::option::Option<DateChangesetPayload_oneof_one_of_time>,
+    // special fields
+    pub unknown_fields: ::protobuf::UnknownFields,
+    pub cached_size: ::protobuf::CachedSize,
+}
+
+impl<'a> ::std::default::Default for &'a DateChangesetPayload {
+    fn default() -> &'a DateChangesetPayload {
+        <DateChangesetPayload as ::protobuf::Message>::default_instance()
+    }
+}
+
+#[derive(Clone,PartialEq,Debug)]
+pub enum DateChangesetPayload_oneof_one_of_date {
+    date(::std::string::String),
+}
+
+#[derive(Clone,PartialEq,Debug)]
+pub enum DateChangesetPayload_oneof_one_of_time {
+    time(::std::string::String),
+}
+
+impl DateChangesetPayload {
+    pub fn new() -> DateChangesetPayload {
+        ::std::default::Default::default()
+    }
+
+    // .CellIdentifierPayload cell_identifier = 1;
+
+
+    pub fn get_cell_identifier(&self) -> &super::cell_entities::CellIdentifierPayload {
+        self.cell_identifier.as_ref().unwrap_or_else(|| <super::cell_entities::CellIdentifierPayload as ::protobuf::Message>::default_instance())
+    }
+    pub fn clear_cell_identifier(&mut self) {
+        self.cell_identifier.clear();
+    }
+
+    pub fn has_cell_identifier(&self) -> bool {
+        self.cell_identifier.is_some()
+    }
+
+    // Param is passed by value, moved
+    pub fn set_cell_identifier(&mut self, v: super::cell_entities::CellIdentifierPayload) {
+        self.cell_identifier = ::protobuf::SingularPtrField::some(v);
+    }
+
+    // Mutable pointer to the field.
+    // If field is not initialized, it is initialized with default value first.
+    pub fn mut_cell_identifier(&mut self) -> &mut super::cell_entities::CellIdentifierPayload {
+        if self.cell_identifier.is_none() {
+            self.cell_identifier.set_default();
+        }
+        self.cell_identifier.as_mut().unwrap()
+    }
+
+    // Take field
+    pub fn take_cell_identifier(&mut self) -> super::cell_entities::CellIdentifierPayload {
+        self.cell_identifier.take().unwrap_or_else(|| super::cell_entities::CellIdentifierPayload::new())
+    }
+
+    // string date = 2;
+
+
+    pub fn get_date(&self) -> &str {
+        match self.one_of_date {
+            ::std::option::Option::Some(DateChangesetPayload_oneof_one_of_date::date(ref v)) => v,
+            _ => "",
+        }
+    }
+    pub fn clear_date(&mut self) {
+        self.one_of_date = ::std::option::Option::None;
+    }
+
+    pub fn has_date(&self) -> bool {
+        match self.one_of_date {
+            ::std::option::Option::Some(DateChangesetPayload_oneof_one_of_date::date(..)) => true,
+            _ => false,
+        }
+    }
+
+    // Param is passed by value, moved
+    pub fn set_date(&mut self, v: ::std::string::String) {
+        self.one_of_date = ::std::option::Option::Some(DateChangesetPayload_oneof_one_of_date::date(v))
+    }
+
+    // Mutable pointer to the field.
+    pub fn mut_date(&mut self) -> &mut ::std::string::String {
+        if let ::std::option::Option::Some(DateChangesetPayload_oneof_one_of_date::date(_)) = self.one_of_date {
+        } else {
+            self.one_of_date = ::std::option::Option::Some(DateChangesetPayload_oneof_one_of_date::date(::std::string::String::new()));
+        }
+        match self.one_of_date {
+            ::std::option::Option::Some(DateChangesetPayload_oneof_one_of_date::date(ref mut v)) => v,
+            _ => panic!(),
+        }
+    }
+
+    // Take field
+    pub fn take_date(&mut self) -> ::std::string::String {
+        if self.has_date() {
+            match self.one_of_date.take() {
+                ::std::option::Option::Some(DateChangesetPayload_oneof_one_of_date::date(v)) => v,
+                _ => panic!(),
+            }
+        } else {
+            ::std::string::String::new()
+        }
+    }
+
+    // string time = 3;
+
+
+    pub fn get_time(&self) -> &str {
+        match self.one_of_time {
+            ::std::option::Option::Some(DateChangesetPayload_oneof_one_of_time::time(ref v)) => v,
+            _ => "",
+        }
+    }
+    pub fn clear_time(&mut self) {
+        self.one_of_time = ::std::option::Option::None;
+    }
+
+    pub fn has_time(&self) -> bool {
+        match self.one_of_time {
+            ::std::option::Option::Some(DateChangesetPayload_oneof_one_of_time::time(..)) => true,
+            _ => false,
+        }
+    }
+
+    // Param is passed by value, moved
+    pub fn set_time(&mut self, v: ::std::string::String) {
+        self.one_of_time = ::std::option::Option::Some(DateChangesetPayload_oneof_one_of_time::time(v))
+    }
+
+    // Mutable pointer to the field.
+    pub fn mut_time(&mut self) -> &mut ::std::string::String {
+        if let ::std::option::Option::Some(DateChangesetPayload_oneof_one_of_time::time(_)) = self.one_of_time {
+        } else {
+            self.one_of_time = ::std::option::Option::Some(DateChangesetPayload_oneof_one_of_time::time(::std::string::String::new()));
+        }
+        match self.one_of_time {
+            ::std::option::Option::Some(DateChangesetPayload_oneof_one_of_time::time(ref mut v)) => v,
+            _ => panic!(),
+        }
+    }
+
+    // Take field
+    pub fn take_time(&mut self) -> ::std::string::String {
+        if self.has_time() {
+            match self.one_of_time.take() {
+                ::std::option::Option::Some(DateChangesetPayload_oneof_one_of_time::time(v)) => v,
+                _ => panic!(),
+            }
+        } else {
+            ::std::string::String::new()
+        }
+    }
+}
+
+impl ::protobuf::Message for DateChangesetPayload {
+    fn is_initialized(&self) -> bool {
+        for v in &self.cell_identifier {
+            if !v.is_initialized() {
+                return false;
+            }
+        };
+        true
+    }
+
+    fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+        while !is.eof()? {
+            let (field_number, wire_type) = is.read_tag_unpack()?;
+            match field_number {
+                1 => {
+                    ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.cell_identifier)?;
+                },
+                2 => {
+                    if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited {
+                        return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+                    }
+                    self.one_of_date = ::std::option::Option::Some(DateChangesetPayload_oneof_one_of_date::date(is.read_string()?));
+                },
+                3 => {
+                    if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited {
+                        return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
+                    }
+                    self.one_of_time = ::std::option::Option::Some(DateChangesetPayload_oneof_one_of_time::time(is.read_string()?));
+                },
+                _ => {
+                    ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
+                },
+            };
+        }
+        ::std::result::Result::Ok(())
+    }
+
+    // Compute sizes of nested messages
+    #[allow(unused_variables)]
+    fn compute_size(&self) -> u32 {
+        let mut my_size = 0;
+        if let Some(ref v) = self.cell_identifier.as_ref() {
+            let len = v.compute_size();
+            my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
+        }
+        if let ::std::option::Option::Some(ref v) = self.one_of_date {
+            match v {
+                &DateChangesetPayload_oneof_one_of_date::date(ref v) => {
+                    my_size += ::protobuf::rt::string_size(2, &v);
+                },
+            };
+        }
+        if let ::std::option::Option::Some(ref v) = self.one_of_time {
+            match v {
+                &DateChangesetPayload_oneof_one_of_time::time(ref v) => {
+                    my_size += ::protobuf::rt::string_size(3, &v);
+                },
+            };
+        }
+        my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
+        self.cached_size.set(my_size);
+        my_size
+    }
+
+    fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
+        if let Some(ref v) = self.cell_identifier.as_ref() {
+            os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+            os.write_raw_varint32(v.get_cached_size())?;
+            v.write_to_with_cached_sizes(os)?;
+        }
+        if let ::std::option::Option::Some(ref v) = self.one_of_date {
+            match v {
+                &DateChangesetPayload_oneof_one_of_date::date(ref v) => {
+                    os.write_string(2, v)?;
+                },
+            };
+        }
+        if let ::std::option::Option::Some(ref v) = self.one_of_time {
+            match v {
+                &DateChangesetPayload_oneof_one_of_time::time(ref v) => {
+                    os.write_string(3, v)?;
+                },
+            };
+        }
+        os.write_unknown_fields(self.get_unknown_fields())?;
+        ::std::result::Result::Ok(())
+    }
+
+    fn get_cached_size(&self) -> u32 {
+        self.cached_size.get()
+    }
+
+    fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
+        &self.unknown_fields
+    }
+
+    fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
+        &mut self.unknown_fields
+    }
+
+    fn as_any(&self) -> &dyn (::std::any::Any) {
+        self as &dyn (::std::any::Any)
+    }
+    fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
+        self as &mut dyn (::std::any::Any)
+    }
+    fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
+        self
+    }
+
+    fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
+        Self::descriptor_static()
+    }
+
+    fn new() -> DateChangesetPayload {
+        DateChangesetPayload::new()
+    }
+
+    fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
+        static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT;
+        descriptor.get(|| {
+            let mut fields = ::std::vec::Vec::new();
+            fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<super::cell_entities::CellIdentifierPayload>>(
+                "cell_identifier",
+                |m: &DateChangesetPayload| { &m.cell_identifier },
+                |m: &mut DateChangesetPayload| { &mut m.cell_identifier },
+            ));
+            fields.push(::protobuf::reflect::accessor::make_singular_string_accessor::<_>(
+                "date",
+                DateChangesetPayload::has_date,
+                DateChangesetPayload::get_date,
+            ));
+            fields.push(::protobuf::reflect::accessor::make_singular_string_accessor::<_>(
+                "time",
+                DateChangesetPayload::has_time,
+                DateChangesetPayload::get_time,
+            ));
+            ::protobuf::reflect::MessageDescriptor::new_pb_name::<DateChangesetPayload>(
+                "DateChangesetPayload",
+                fields,
+                file_descriptor_proto()
+            )
+        })
+    }
+
+    fn default_instance() -> &'static DateChangesetPayload {
+        static instance: ::protobuf::rt::LazyV2<DateChangesetPayload> = ::protobuf::rt::LazyV2::INIT;
+        instance.get(DateChangesetPayload::new)
+    }
+}
+
+impl ::protobuf::Clear for DateChangesetPayload {
+    fn clear(&mut self) {
+        self.cell_identifier.clear();
+        self.one_of_date = ::std::option::Option::None;
+        self.one_of_time = ::std::option::Option::None;
+        self.unknown_fields.clear();
+    }
+}
+
+impl ::std::fmt::Debug for DateChangesetPayload {
+    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+        ::protobuf::text_format::fmt(self, f)
+    }
+}
+
+impl ::protobuf::reflect::ProtobufValue for DateChangesetPayload {
+    fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
+        ::protobuf::reflect::ReflectValueRef::Message(self)
+    }
+}
+
 #[derive(Clone,PartialEq,Eq,Debug,Hash)]
 pub enum DateFormat {
     Local = 0,
@@ -344,13 +681,17 @@ impl ::protobuf::reflect::ProtobufValue for TimeFormat {
 }
 
 static file_descriptor_proto_data: &'static [u8] = b"\
-    \n\x16date_type_option.proto\"\x8f\x01\n\x0eDateTypeOption\x12,\n\x0bdat\
-    e_format\x18\x01\x20\x01(\x0e2\x0b.DateFormatR\ndateFormat\x12,\n\x0btim\
-    e_format\x18\x02\x20\x01(\x0e2\x0b.TimeFormatR\ntimeFormat\x12!\n\x0cinc\
-    lude_time\x18\x03\x20\x01(\x08R\x0bincludeTime*6\n\nDateFormat\x12\t\n\
-    \x05Local\x10\0\x12\x06\n\x02US\x10\x01\x12\x07\n\x03ISO\x10\x02\x12\x0c\
-    \n\x08Friendly\x10\x03*0\n\nTimeFormat\x12\x0e\n\nTwelveHour\x10\0\x12\
-    \x12\n\x0eTwentyFourHour\x10\x01b\x06proto3\
+    \n\x16date_type_option.proto\x1a\x13cell_entities.proto\"\x8f\x01\n\x0eD\
+    ateTypeOption\x12,\n\x0bdate_format\x18\x01\x20\x01(\x0e2\x0b.DateFormat\
+    R\ndateFormat\x12,\n\x0btime_format\x18\x02\x20\x01(\x0e2\x0b.TimeFormat\
+    R\ntimeFormat\x12!\n\x0cinclude_time\x18\x03\x20\x01(\x08R\x0bincludeTim\
+    e\"\xa1\x01\n\x14DateChangesetPayload\x12?\n\x0fcell_identifier\x18\x01\
+    \x20\x01(\x0b2\x16.CellIdentifierPayloadR\x0ecellIdentifier\x12\x14\n\
+    \x04date\x18\x02\x20\x01(\tH\0R\x04date\x12\x14\n\x04time\x18\x03\x20\
+    \x01(\tH\x01R\x04timeB\r\n\x0bone_of_dateB\r\n\x0bone_of_time*6\n\nDateF\
+    ormat\x12\t\n\x05Local\x10\0\x12\x06\n\x02US\x10\x01\x12\x07\n\x03ISO\
+    \x10\x02\x12\x0c\n\x08Friendly\x10\x03*0\n\nTimeFormat\x12\x0e\n\nTwelve\
+    Hour\x10\0\x12\x12\n\x0eTwentyFourHour\x10\x01b\x06proto3\
 ";
 
 static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;

+ 9 - 5
frontend/rust-lib/flowy-grid/src/protobuf/model/event_map.rs

@@ -46,7 +46,8 @@ pub enum GridEvent {
     DuplicateRow = 53,
     GetCell = 70,
     UpdateCell = 71,
-    UpdateCellSelectOption = 72,
+    UpdateSelectOptionCell = 72,
+    UpdateDateCell = 80,
 }
 
 impl ::protobuf::ProtobufEnum for GridEvent {
@@ -77,7 +78,8 @@ impl ::protobuf::ProtobufEnum for GridEvent {
             53 => ::std::option::Option::Some(GridEvent::DuplicateRow),
             70 => ::std::option::Option::Some(GridEvent::GetCell),
             71 => ::std::option::Option::Some(GridEvent::UpdateCell),
-            72 => ::std::option::Option::Some(GridEvent::UpdateCellSelectOption),
+            72 => ::std::option::Option::Some(GridEvent::UpdateSelectOptionCell),
+            80 => ::std::option::Option::Some(GridEvent::UpdateDateCell),
             _ => ::std::option::Option::None
         }
     }
@@ -105,7 +107,8 @@ impl ::protobuf::ProtobufEnum for GridEvent {
             GridEvent::DuplicateRow,
             GridEvent::GetCell,
             GridEvent::UpdateCell,
-            GridEvent::UpdateCellSelectOption,
+            GridEvent::UpdateSelectOptionCell,
+            GridEvent::UpdateDateCell,
         ];
         values
     }
@@ -134,7 +137,7 @@ impl ::protobuf::reflect::ProtobufValue for GridEvent {
 }
 
 static file_descriptor_proto_data: &'static [u8] = b"\
-    \n\x0fevent_map.proto*\xb0\x03\n\tGridEvent\x12\x0f\n\x0bGetGridData\x10\
+    \n\x0fevent_map.proto*\xc4\x03\n\tGridEvent\x12\x0f\n\x0bGetGridData\x10\
     \0\x12\x11\n\rGetGridBlocks\x10\x01\x12\r\n\tGetFields\x10\n\x12\x0f\n\
     \x0bUpdateField\x10\x0b\x12\x19\n\x15UpdateFieldTypeOption\x10\x0c\x12\
     \x0f\n\x0bInsertField\x10\r\x12\x0f\n\x0bDeleteField\x10\x0e\x12\x11\n\r\
@@ -144,7 +147,8 @@ static file_descriptor_proto_data: &'static [u8] = b"\
     \x16GetSelectOptionContext\x10\x1f\x12\x16\n\x12UpdateSelectOption\x10\
     \x20\x12\r\n\tCreateRow\x102\x12\n\n\x06GetRow\x103\x12\r\n\tDeleteRow\
     \x104\x12\x10\n\x0cDuplicateRow\x105\x12\x0b\n\x07GetCell\x10F\x12\x0e\n\
-    \nUpdateCell\x10G\x12\x1a\n\x16UpdateCellSelectOption\x10Hb\x06proto3\
+    \nUpdateCell\x10G\x12\x1a\n\x16UpdateSelectOptionCell\x10H\x12\x12\n\x0e\
+    UpdateDateCell\x10Pb\x06proto3\
 ";
 
 static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;

+ 54 - 124
frontend/rust-lib/flowy-grid/src/protobuf/model/selection_type_option.rs

@@ -1102,9 +1102,7 @@ impl ::protobuf::reflect::ProtobufValue for SelectOptionChangesetPayload {
 #[derive(PartialEq,Clone,Default)]
 pub struct SelectOptionCellChangesetPayload {
     // message fields
-    pub grid_id: ::std::string::String,
-    pub row_id: ::std::string::String,
-    pub field_id: ::std::string::String,
+    pub cell_identifier: ::protobuf::SingularPtrField<super::cell_entities::CellIdentifierPayload>,
     // message oneof groups
     pub one_of_insert_option_id: ::std::option::Option<SelectOptionCellChangesetPayload_oneof_one_of_insert_option_id>,
     pub one_of_delete_option_id: ::std::option::Option<SelectOptionCellChangesetPayload_oneof_one_of_delete_option_id>,
@@ -1134,85 +1132,40 @@ impl SelectOptionCellChangesetPayload {
         ::std::default::Default::default()
     }
 
-    // string grid_id = 1;
-
-
-    pub fn get_grid_id(&self) -> &str {
-        &self.grid_id
-    }
-    pub fn clear_grid_id(&mut self) {
-        self.grid_id.clear();
-    }
-
-    // Param is passed by value, moved
-    pub fn set_grid_id(&mut self, v: ::std::string::String) {
-        self.grid_id = v;
-    }
-
-    // Mutable pointer to the field.
-    // If field is not initialized, it is initialized with default value first.
-    pub fn mut_grid_id(&mut self) -> &mut ::std::string::String {
-        &mut self.grid_id
-    }
-
-    // Take field
-    pub fn take_grid_id(&mut self) -> ::std::string::String {
-        ::std::mem::replace(&mut self.grid_id, ::std::string::String::new())
-    }
-
-    // string row_id = 2;
-
-
-    pub fn get_row_id(&self) -> &str {
-        &self.row_id
-    }
-    pub fn clear_row_id(&mut self) {
-        self.row_id.clear();
-    }
+    // .CellIdentifierPayload cell_identifier = 1;
 
-    // Param is passed by value, moved
-    pub fn set_row_id(&mut self, v: ::std::string::String) {
-        self.row_id = v;
-    }
 
-    // Mutable pointer to the field.
-    // If field is not initialized, it is initialized with default value first.
-    pub fn mut_row_id(&mut self) -> &mut ::std::string::String {
-        &mut self.row_id
+    pub fn get_cell_identifier(&self) -> &super::cell_entities::CellIdentifierPayload {
+        self.cell_identifier.as_ref().unwrap_or_else(|| <super::cell_entities::CellIdentifierPayload as ::protobuf::Message>::default_instance())
     }
-
-    // Take field
-    pub fn take_row_id(&mut self) -> ::std::string::String {
-        ::std::mem::replace(&mut self.row_id, ::std::string::String::new())
+    pub fn clear_cell_identifier(&mut self) {
+        self.cell_identifier.clear();
     }
 
-    // string field_id = 3;
-
-
-    pub fn get_field_id(&self) -> &str {
-        &self.field_id
-    }
-    pub fn clear_field_id(&mut self) {
-        self.field_id.clear();
+    pub fn has_cell_identifier(&self) -> bool {
+        self.cell_identifier.is_some()
     }
 
     // Param is passed by value, moved
-    pub fn set_field_id(&mut self, v: ::std::string::String) {
-        self.field_id = v;
+    pub fn set_cell_identifier(&mut self, v: super::cell_entities::CellIdentifierPayload) {
+        self.cell_identifier = ::protobuf::SingularPtrField::some(v);
     }
 
     // Mutable pointer to the field.
     // If field is not initialized, it is initialized with default value first.
-    pub fn mut_field_id(&mut self) -> &mut ::std::string::String {
-        &mut self.field_id
+    pub fn mut_cell_identifier(&mut self) -> &mut super::cell_entities::CellIdentifierPayload {
+        if self.cell_identifier.is_none() {
+            self.cell_identifier.set_default();
+        }
+        self.cell_identifier.as_mut().unwrap()
     }
 
     // Take field
-    pub fn take_field_id(&mut self) -> ::std::string::String {
-        ::std::mem::replace(&mut self.field_id, ::std::string::String::new())
+    pub fn take_cell_identifier(&mut self) -> super::cell_entities::CellIdentifierPayload {
+        self.cell_identifier.take().unwrap_or_else(|| super::cell_entities::CellIdentifierPayload::new())
     }
 
-    // string insert_option_id = 4;
+    // string insert_option_id = 2;
 
 
     pub fn get_insert_option_id(&self) -> &str {
@@ -1261,7 +1214,7 @@ impl SelectOptionCellChangesetPayload {
         }
     }
 
-    // string delete_option_id = 5;
+    // string delete_option_id = 3;
 
 
     pub fn get_delete_option_id(&self) -> &str {
@@ -1313,6 +1266,11 @@ impl SelectOptionCellChangesetPayload {
 
 impl ::protobuf::Message for SelectOptionCellChangesetPayload {
     fn is_initialized(&self) -> bool {
+        for v in &self.cell_identifier {
+            if !v.is_initialized() {
+                return false;
+            }
+        };
         true
     }
 
@@ -1321,21 +1279,15 @@ impl ::protobuf::Message for SelectOptionCellChangesetPayload {
             let (field_number, wire_type) = is.read_tag_unpack()?;
             match field_number {
                 1 => {
-                    ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.grid_id)?;
+                    ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.cell_identifier)?;
                 },
                 2 => {
-                    ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.row_id)?;
-                },
-                3 => {
-                    ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.field_id)?;
-                },
-                4 => {
                     if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited {
                         return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
                     }
                     self.one_of_insert_option_id = ::std::option::Option::Some(SelectOptionCellChangesetPayload_oneof_one_of_insert_option_id::insert_option_id(is.read_string()?));
                 },
-                5 => {
+                3 => {
                     if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited {
                         return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
                     }
@@ -1353,26 +1305,21 @@ impl ::protobuf::Message for SelectOptionCellChangesetPayload {
     #[allow(unused_variables)]
     fn compute_size(&self) -> u32 {
         let mut my_size = 0;
-        if !self.grid_id.is_empty() {
-            my_size += ::protobuf::rt::string_size(1, &self.grid_id);
-        }
-        if !self.row_id.is_empty() {
-            my_size += ::protobuf::rt::string_size(2, &self.row_id);
-        }
-        if !self.field_id.is_empty() {
-            my_size += ::protobuf::rt::string_size(3, &self.field_id);
+        if let Some(ref v) = self.cell_identifier.as_ref() {
+            let len = v.compute_size();
+            my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
         }
         if let ::std::option::Option::Some(ref v) = self.one_of_insert_option_id {
             match v {
                 &SelectOptionCellChangesetPayload_oneof_one_of_insert_option_id::insert_option_id(ref v) => {
-                    my_size += ::protobuf::rt::string_size(4, &v);
+                    my_size += ::protobuf::rt::string_size(2, &v);
                 },
             };
         }
         if let ::std::option::Option::Some(ref v) = self.one_of_delete_option_id {
             match v {
                 &SelectOptionCellChangesetPayload_oneof_one_of_delete_option_id::delete_option_id(ref v) => {
-                    my_size += ::protobuf::rt::string_size(5, &v);
+                    my_size += ::protobuf::rt::string_size(3, &v);
                 },
             };
         }
@@ -1382,26 +1329,22 @@ impl ::protobuf::Message for SelectOptionCellChangesetPayload {
     }
 
     fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
-        if !self.grid_id.is_empty() {
-            os.write_string(1, &self.grid_id)?;
-        }
-        if !self.row_id.is_empty() {
-            os.write_string(2, &self.row_id)?;
-        }
-        if !self.field_id.is_empty() {
-            os.write_string(3, &self.field_id)?;
+        if let Some(ref v) = self.cell_identifier.as_ref() {
+            os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?;
+            os.write_raw_varint32(v.get_cached_size())?;
+            v.write_to_with_cached_sizes(os)?;
         }
         if let ::std::option::Option::Some(ref v) = self.one_of_insert_option_id {
             match v {
                 &SelectOptionCellChangesetPayload_oneof_one_of_insert_option_id::insert_option_id(ref v) => {
-                    os.write_string(4, v)?;
+                    os.write_string(2, v)?;
                 },
             };
         }
         if let ::std::option::Option::Some(ref v) = self.one_of_delete_option_id {
             match v {
                 &SelectOptionCellChangesetPayload_oneof_one_of_delete_option_id::delete_option_id(ref v) => {
-                    os.write_string(5, v)?;
+                    os.write_string(3, v)?;
                 },
             };
         }
@@ -1443,20 +1386,10 @@ impl ::protobuf::Message for SelectOptionCellChangesetPayload {
         static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT;
         descriptor.get(|| {
             let mut fields = ::std::vec::Vec::new();
-            fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
-                "grid_id",
-                |m: &SelectOptionCellChangesetPayload| { &m.grid_id },
-                |m: &mut SelectOptionCellChangesetPayload| { &mut m.grid_id },
-            ));
-            fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
-                "row_id",
-                |m: &SelectOptionCellChangesetPayload| { &m.row_id },
-                |m: &mut SelectOptionCellChangesetPayload| { &mut m.row_id },
-            ));
-            fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
-                "field_id",
-                |m: &SelectOptionCellChangesetPayload| { &m.field_id },
-                |m: &mut SelectOptionCellChangesetPayload| { &mut m.field_id },
+            fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<super::cell_entities::CellIdentifierPayload>>(
+                "cell_identifier",
+                |m: &SelectOptionCellChangesetPayload| { &m.cell_identifier },
+                |m: &mut SelectOptionCellChangesetPayload| { &mut m.cell_identifier },
             ));
             fields.push(::protobuf::reflect::accessor::make_singular_string_accessor::<_>(
                 "insert_option_id",
@@ -1484,9 +1417,7 @@ impl ::protobuf::Message for SelectOptionCellChangesetPayload {
 
 impl ::protobuf::Clear for SelectOptionCellChangesetPayload {
     fn clear(&mut self) {
-        self.grid_id.clear();
-        self.row_id.clear();
-        self.field_id.clear();
+        self.cell_identifier.clear();
         self.one_of_insert_option_id = ::std::option::Option::None;
         self.one_of_delete_option_id = ::std::option::Option::None;
         self.unknown_fields.clear();
@@ -1806,19 +1737,18 @@ static file_descriptor_proto_data: &'static [u8] = b"\
     _option\x18\x03\x20\x01(\x0b2\r.SelectOptionH\x01R\x0cupdateOption\x124\
     \n\rdelete_option\x18\x04\x20\x01(\x0b2\r.SelectOptionH\x02R\x0cdeleteOp\
     tionB\x16\n\x14one_of_insert_optionB\x16\n\x14one_of_update_optionB\x16\
-    \n\x14one_of_delete_option\"\xfb\x01\n\x20SelectOptionCellChangesetPaylo\
-    ad\x12\x17\n\x07grid_id\x18\x01\x20\x01(\tR\x06gridId\x12\x15\n\x06row_i\
-    d\x18\x02\x20\x01(\tR\x05rowId\x12\x19\n\x08field_id\x18\x03\x20\x01(\tR\
-    \x07fieldId\x12*\n\x10insert_option_id\x18\x04\x20\x01(\tH\0R\x0einsertO\
-    ptionId\x12*\n\x10delete_option_id\x18\x05\x20\x01(\tH\x01R\x0edeleteOpt\
-    ionIdB\x19\n\x17one_of_insert_option_idB\x19\n\x17one_of_delete_option_i\
-    d\"t\n\x13SelectOptionContext\x12'\n\x07options\x18\x01\x20\x03(\x0b2\r.\
-    SelectOptionR\x07options\x124\n\x0eselect_options\x18\x02\x20\x03(\x0b2\
-    \r.SelectOptionR\rselectOptions*y\n\x11SelectOptionColor\x12\n\n\x06Purp\
-    le\x10\0\x12\x08\n\x04Pink\x10\x01\x12\r\n\tLightPink\x10\x02\x12\n\n\
-    \x06Orange\x10\x03\x12\n\n\x06Yellow\x10\x04\x12\x08\n\x04Lime\x10\x05\
-    \x12\t\n\x05Green\x10\x06\x12\x08\n\x04Aqua\x10\x07\x12\x08\n\x04Blue\
-    \x10\x08b\x06proto3\
+    \n\x14one_of_delete_option\"\xf1\x01\n\x20SelectOptionCellChangesetPaylo\
+    ad\x12?\n\x0fcell_identifier\x18\x01\x20\x01(\x0b2\x16.CellIdentifierPay\
+    loadR\x0ecellIdentifier\x12*\n\x10insert_option_id\x18\x02\x20\x01(\tH\0\
+    R\x0einsertOptionId\x12*\n\x10delete_option_id\x18\x03\x20\x01(\tH\x01R\
+    \x0edeleteOptionIdB\x19\n\x17one_of_insert_option_idB\x19\n\x17one_of_de\
+    lete_option_id\"t\n\x13SelectOptionContext\x12'\n\x07options\x18\x01\x20\
+    \x03(\x0b2\r.SelectOptionR\x07options\x124\n\x0eselect_options\x18\x02\
+    \x20\x03(\x0b2\r.SelectOptionR\rselectOptions*y\n\x11SelectOptionColor\
+    \x12\n\n\x06Purple\x10\0\x12\x08\n\x04Pink\x10\x01\x12\r\n\tLightPink\
+    \x10\x02\x12\n\n\x06Orange\x10\x03\x12\n\n\x06Yellow\x10\x04\x12\x08\n\
+    \x04Lime\x10\x05\x12\t\n\x05Green\x10\x06\x12\x08\n\x04Aqua\x10\x07\x12\
+    \x08\n\x04Blue\x10\x08b\x06proto3\
 ";
 
 static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;

+ 6 - 0
frontend/rust-lib/flowy-grid/src/protobuf/proto/date_type_option.proto

@@ -1,10 +1,16 @@
 syntax = "proto3";
+import "cell_entities.proto";
 
 message DateTypeOption {
     DateFormat date_format = 1;
     TimeFormat time_format = 2;
     bool include_time = 3;
 }
+message DateChangesetPayload {
+    CellIdentifierPayload cell_identifier = 1;
+    oneof one_of_date { string date = 2; };
+    oneof one_of_time { string time = 3; };
+}
 enum DateFormat {
     Local = 0;
     US = 1;

+ 2 - 1
frontend/rust-lib/flowy-grid/src/protobuf/proto/event_map.proto

@@ -22,5 +22,6 @@ enum GridEvent {
     DuplicateRow = 53;
     GetCell = 70;
     UpdateCell = 71;
-    UpdateCellSelectOption = 72;
+    UpdateSelectOptionCell = 72;
+    UpdateDateCell = 80;
 }

+ 3 - 5
frontend/rust-lib/flowy-grid/src/protobuf/proto/selection_type_option.proto

@@ -21,11 +21,9 @@ message SelectOptionChangesetPayload {
     oneof one_of_delete_option { SelectOption delete_option = 4; };
 }
 message SelectOptionCellChangesetPayload {
-    string grid_id = 1;
-    string row_id = 2;
-    string field_id = 3;
-    oneof one_of_insert_option_id { string insert_option_id = 4; };
-    oneof one_of_delete_option_id { string delete_option_id = 5; };
+    CellIdentifierPayload cell_identifier = 1;
+    oneof one_of_insert_option_id { string insert_option_id = 2; };
+    oneof one_of_delete_option_id { string delete_option_id = 3; };
 }
 message SelectOptionContext {
     repeated SelectOption options = 1;

+ 9 - 9
frontend/rust-lib/flowy-grid/src/services/field/type_options/checkbox_type_option.rs

@@ -1,6 +1,6 @@
 use crate::impl_type_option;
 use crate::services::field::{BoxTypeOptionBuilder, TypeOptionBuilder};
-use crate::services::row::{CellDataChangeset, CellDataOperation, DecodedCellData, TypeOptionCellData};
+use crate::services::row::{CellContentChangeset, CellDataOperation, DecodedCellData, TypeOptionCellData};
 use bytes::Bytes;
 use flowy_derive::ProtoBuf;
 use flowy_error::FlowyError;
@@ -44,7 +44,7 @@ const YES: &str = "Yes";
 const NO: &str = "No";
 
 impl CellDataOperation for CheckboxTypeOption {
-    fn decode_cell_data(&self, data: String, field_meta: &FieldMeta) -> DecodedCellData {
+    fn decode_cell_data(&self, data: String, _field_meta: &FieldMeta) -> DecodedCellData {
         if let Ok(type_option_cell_data) = TypeOptionCellData::from_str(&data) {
             if !type_option_cell_data.is_checkbox() {
                 return DecodedCellData::default();
@@ -58,7 +58,7 @@ impl CellDataOperation for CheckboxTypeOption {
         DecodedCellData::default()
     }
 
-    fn apply_changeset<T: Into<CellDataChangeset>>(
+    fn apply_changeset<T: Into<CellContentChangeset>>(
         &self,
         changeset: T,
         _cell_meta: Option<CellMeta>,
@@ -99,21 +99,21 @@ mod tests {
         let field_meta = FieldBuilder::from_field_type(&FieldType::DateTime).build();
 
         let data = type_option.apply_changeset("true", None).unwrap();
-        assert_eq!(type_option.decode_cell_data(data, &field_meta), YES);
+        assert_eq!(type_option.decode_cell_data(data, &field_meta).content, YES);
 
         let data = type_option.apply_changeset("1", None).unwrap();
-        assert_eq!(type_option.decode_cell_data(data, &field_meta), YES);
+        assert_eq!(type_option.decode_cell_data(data, &field_meta).content, YES);
 
         let data = type_option.apply_changeset("yes", None).unwrap();
-        assert_eq!(type_option.decode_cell_data(data, &field_meta), YES);
+        assert_eq!(type_option.decode_cell_data(data, &field_meta).content, YES);
 
         let data = type_option.apply_changeset("false", None).unwrap();
-        assert_eq!(type_option.decode_cell_data(data, &field_meta), NO);
+        assert_eq!(type_option.decode_cell_data(data, &field_meta).content, NO);
 
         let data = type_option.apply_changeset("no", None).unwrap();
-        assert_eq!(type_option.decode_cell_data(data, &field_meta), NO);
+        assert_eq!(type_option.decode_cell_data(data, &field_meta).content, NO);
 
         let data = type_option.apply_changeset("123", None).unwrap();
-        assert_eq!(type_option.decode_cell_data(data, &field_meta), NO);
+        assert_eq!(type_option.decode_cell_data(data, &field_meta).content, NO);
     }
 }

+ 74 - 15
frontend/rust-lib/flowy-grid/src/services/field/type_options/date_type_option.rs

@@ -1,17 +1,19 @@
 use crate::impl_type_option;
-use crate::services::row::{CellDataChangeset, CellDataOperation, DecodedCellData, TypeOptionCellData};
+use crate::services::row::{CellContentChangeset, CellDataOperation, DecodedCellData, TypeOptionCellData};
 use bytes::Bytes;
 use chrono::format::strftime::StrftimeItems;
-use chrono::{NaiveDateTime, ParseResult};
+use chrono::{Datelike, NaiveDateTime};
 use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
-use flowy_error::FlowyError;
+use flowy_error::{ErrorCode, FlowyError};
 use flowy_grid_data_model::entities::{
-    CellMeta, FieldMeta, FieldType, TypeOptionDataDeserializer, TypeOptionDataEntry,
+    CellChangeset, CellMeta, FieldMeta, FieldType, TypeOptionDataDeserializer, TypeOptionDataEntry,
 };
 
 use serde::{Deserialize, Serialize};
 use std::str::FromStr;
 
+use crate::services::entities::{CellIdentifier, CellIdentifierPayload};
+use crate::services::field::type_options::util::get_cell_data;
 use crate::services::field::{BoxTypeOptionBuilder, TypeOptionBuilder};
 use strum_macros::EnumIter;
 
@@ -53,7 +55,7 @@ impl DateTypeOption {
 }
 
 impl CellDataOperation for DateTypeOption {
-    fn decode_cell_data(&self, data: String, field_meta: &FieldMeta) -> DecodedCellData {
+    fn decode_cell_data(&self, data: String, _field_meta: &FieldMeta) -> DecodedCellData {
         if let Ok(type_option_cell_data) = TypeOptionCellData::from_str(&data) {
             if !type_option_cell_data.is_date() {
                 return DecodedCellData::default();
@@ -74,7 +76,7 @@ impl CellDataOperation for DateTypeOption {
         DecodedCellData::default()
     }
 
-    fn apply_changeset<T: Into<CellDataChangeset>>(
+    fn apply_changeset<T: Into<CellContentChangeset>>(
         &self,
         changeset: T,
         _cell_meta: Option<CellMeta>,
@@ -196,6 +198,59 @@ impl std::default::Default for TimeFormat {
     }
 }
 
+#[derive(Clone, Debug, Default, ProtoBuf)]
+pub struct DateChangesetPayload {
+    #[pb(index = 1)]
+    pub cell_identifier: CellIdentifierPayload,
+
+    #[pb(index = 2, one_of)]
+    pub date: Option<String>,
+
+    #[pb(index = 3, one_of)]
+    pub time: Option<String>,
+}
+
+pub struct DateChangesetParams {
+    pub cell_identifier: CellIdentifier,
+    pub date: Option<String>,
+    pub time: Option<String>,
+}
+
+impl TryInto<DateChangesetParams> for DateChangesetPayload {
+    type Error = ErrorCode;
+
+    fn try_into(self) -> Result<DateChangesetParams, Self::Error> {
+        let cell_identifier: CellIdentifier = self.cell_identifier.try_into()?;
+        Ok(DateChangesetParams {
+            cell_identifier,
+            date: self.date,
+            time: self.time,
+        })
+    }
+}
+
+#[derive(Clone, Serialize, Deserialize)]
+pub struct DateCellContentChangeset {
+    pub date: Option<String>,
+    pub time: Option<String>,
+}
+
+impl std::convert::From<DateChangesetParams> for CellChangeset {
+    fn from(params: DateChangesetParams) -> Self {
+        let changeset = DateCellContentChangeset {
+            date: params.date,
+            time: params.time,
+        };
+        let s = serde_json::to_string(&changeset).unwrap();
+        CellChangeset {
+            grid_id: params.cell_identifier.grid_id,
+            row_id: params.cell_identifier.row_id,
+            field_id: params.cell_identifier.field_id,
+            cell_content_changeset: Some(s),
+        }
+    }
+}
+
 #[cfg(test)]
 mod tests {
     use crate::services::field::FieldBuilder;
@@ -210,7 +265,7 @@ mod tests {
         let field_meta = FieldBuilder::from_field_type(&FieldType::Number).build();
         assert_eq!(
             "".to_owned(),
-            type_option.decode_cell_data("1e".to_owned(), &field_meta)
+            type_option.decode_cell_data("1e".to_owned(), &field_meta).content
         );
     }
 
@@ -224,35 +279,39 @@ mod tests {
                 DateFormat::Friendly => {
                     assert_eq!(
                         "Mar 14,2022".to_owned(),
-                        type_option.decode_cell_data(data("1647251762"), &field_meta)
+                        type_option.decode_cell_data(data("1647251762"), &field_meta).content
                     );
                     assert_eq!(
                         // "Mar 14,2022".to_owned(),
                         "".to_owned(),
-                        type_option.decode_cell_data(data("Mar 14,2022 17:56"), &field_meta)
+                        type_option
+                            .decode_cell_data(data("Mar 14,2022 17:56"), &field_meta)
+                            .content
                     );
                 }
                 DateFormat::US => {
                     assert_eq!(
                         "2022/03/14".to_owned(),
-                        type_option.decode_cell_data(data("1647251762"), &field_meta)
+                        type_option.decode_cell_data(data("1647251762"), &field_meta).content
                     );
                     assert_eq!(
                         // "2022/03/14".to_owned(),
                         "".to_owned(),
-                        type_option.decode_cell_data(data("2022/03/14 17:56"), &field_meta)
+                        type_option
+                            .decode_cell_data(data("2022/03/14 17:56"), &field_meta)
+                            .content
                     );
                 }
                 DateFormat::ISO => {
                     assert_eq!(
                         "2022-03-14".to_owned(),
-                        type_option.decode_cell_data(data("1647251762"), &field_meta)
+                        type_option.decode_cell_data(data("1647251762"), &field_meta).content
                     );
                 }
                 DateFormat::Local => {
                     assert_eq!(
                         "2022/03/14".to_owned(),
-                        type_option.decode_cell_data(data("1647251762"), &field_meta)
+                        type_option.decode_cell_data(data("1647251762"), &field_meta).content
                     );
                 }
             }
@@ -270,14 +329,14 @@ mod tests {
                     assert_eq!("Mar 14,2022".to_owned(), type_option.today_from_timestamp(1647251762));
                     assert_eq!(
                         "Mar 14,2022".to_owned(),
-                        type_option.decode_cell_data(data("1647251762"), &field_meta)
+                        type_option.decode_cell_data(data("1647251762"), &field_meta).content
                     );
                 }
                 TimeFormat::TwelveHour => {
                     assert_eq!("Mar 14,2022".to_owned(), type_option.today_from_timestamp(1647251762));
                     assert_eq!(
                         "Mar 14,2022".to_owned(),
-                        type_option.decode_cell_data(data("1647251762"), &field_meta)
+                        type_option.decode_cell_data(data("1647251762"), &field_meta).content
                     );
                 }
             }

+ 1 - 1
frontend/rust-lib/flowy-grid/src/services/field/type_options/mod.rs

@@ -3,7 +3,7 @@ mod date_type_option;
 mod number_type_option;
 mod selection_type_option;
 mod text_type_option;
-mod type_option_data;
+mod util;
 
 pub use checkbox_type_option::*;
 pub use date_type_option::*;

+ 36 - 25
frontend/rust-lib/flowy-grid/src/services/field/type_options/number_type_option.rs

@@ -1,6 +1,6 @@
 use crate::impl_type_option;
 use crate::services::field::{BoxTypeOptionBuilder, TypeOptionBuilder};
-use crate::services::row::{CellDataChangeset, CellDataOperation, DecodedCellData, TypeOptionCellData};
+use crate::services::row::{CellContentChangeset, CellDataOperation, DecodedCellData, TypeOptionCellData};
 use bytes::Bytes;
 use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
 use flowy_error::FlowyError;
@@ -77,14 +77,14 @@ pub struct NumberTypeOption {
 impl_type_option!(NumberTypeOption, FieldType::Number);
 
 impl CellDataOperation for NumberTypeOption {
-    fn decode_cell_data(&self, data: String, field_meta: &FieldMeta) -> DecodedCellData {
+    fn decode_cell_data(&self, data: String, _field_meta: &FieldMeta) -> DecodedCellData {
         if let Ok(type_option_cell_data) = TypeOptionCellData::from_str(&data) {
             if type_option_cell_data.is_date() {
                 return DecodedCellData::default();
             }
 
             let cell_data = type_option_cell_data.data;
-            return match self.format {
+            match self.format {
                 NumberFormat::Number => {
                     if let Ok(v) = cell_data.parse::<f64>() {
                         return DecodedCellData::from_content(v.to_string());
@@ -104,13 +104,13 @@ impl CellDataOperation for NumberTypeOption {
                     let content = self.money_from_str(&cell_data);
                     DecodedCellData::from_content(content)
                 }
-            };
+            }
         } else {
             DecodedCellData::default()
         }
     }
 
-    fn apply_changeset<T: Into<CellDataChangeset>>(
+    fn apply_changeset<T: Into<CellContentChangeset>>(
         &self,
         changeset: T,
         _cell_meta: Option<CellMeta>,
@@ -562,7 +562,7 @@ define_currency_set!(
 
 impl NumberFormat {
     pub fn currency(&self) -> &'static number_currency::Currency {
-        let currency = match self {
+        match self {
             NumberFormat::Number => number_currency::NUMBER,
             NumberFormat::USD => number_currency::USD,
             NumberFormat::CanadianDollar => number_currency::CANADIAN_DOLLAR,
@@ -599,8 +599,7 @@ impl NumberFormat {
             NumberFormat::ArgentinePeso => number_currency::ARS,
             NumberFormat::UruguayanPeso => number_currency::UYU,
             NumberFormat::Percent => number_currency::USD,
-        };
-        currency
+        }
     }
 
     pub fn symbol(&self) -> String {
@@ -628,8 +627,14 @@ mod tests {
     fn number_description_invalid_input_test() {
         let type_option = NumberTypeOption::default();
         let field_meta = FieldBuilder::from_field_type(&FieldType::Number).build();
-        assert_eq!("".to_owned(), type_option.decode_cell_data(data(""), &field_meta));
-        assert_eq!("".to_owned(), type_option.decode_cell_data(data("abc"), &field_meta));
+        assert_eq!(
+            "".to_owned(),
+            type_option.decode_cell_data(data(""), &field_meta).content
+        );
+        assert_eq!(
+            "".to_owned(),
+            type_option.decode_cell_data(data("abc"), &field_meta).content
+        );
     }
 
     #[test]
@@ -645,33 +650,39 @@ mod tests {
             match format {
                 NumberFormat::Number => {
                     assert_eq!(
-                        type_option.decode_cell_data(data("18443"), &field_meta),
+                        type_option.decode_cell_data(data("18443"), &field_meta).content,
                         "18443".to_owned()
                     );
                 }
                 NumberFormat::USD => {
                     assert_eq!(
-                        type_option.decode_cell_data(data("18443"), &field_meta),
+                        type_option.decode_cell_data(data("18443"), &field_meta).content,
                         "$18,443".to_owned()
                     );
-                    assert_eq!(type_option.decode_cell_data(data(""), &field_meta), "".to_owned());
-                    assert_eq!(type_option.decode_cell_data(data("abc"), &field_meta), "".to_owned());
+                    assert_eq!(
+                        type_option.decode_cell_data(data(""), &field_meta).content,
+                        "".to_owned()
+                    );
+                    assert_eq!(
+                        type_option.decode_cell_data(data("abc"), &field_meta).content,
+                        "".to_owned()
+                    );
                 }
                 NumberFormat::Yen => {
                     assert_eq!(
-                        type_option.decode_cell_data(data("18443"), &field_meta),
+                        type_option.decode_cell_data(data("18443"), &field_meta).content,
                         "¥18,443".to_owned()
                     );
                 }
                 NumberFormat::Yuan => {
                     assert_eq!(
-                        type_option.decode_cell_data(data("18443"), &field_meta),
+                        type_option.decode_cell_data(data("18443"), &field_meta).content,
                         "CN¥18,443".to_owned()
                     );
                 }
                 NumberFormat::EUR => {
                     assert_eq!(
-                        type_option.decode_cell_data(data("18443"), &field_meta),
+                        type_option.decode_cell_data(data("18443"), &field_meta).content,
                         "€18.443".to_owned()
                     );
                 }
@@ -697,25 +708,25 @@ mod tests {
             match format {
                 NumberFormat::Number => {
                     assert_eq!(
-                        type_option.decode_cell_data(data("18443"), &field_meta),
+                        type_option.decode_cell_data(data("18443"), &field_meta).content,
                         "18443".to_owned()
                     );
                 }
                 NumberFormat::USD => {
                     assert_eq!(
-                        type_option.decode_cell_data(data("18443"), &field_meta),
+                        type_option.decode_cell_data(data("18443"), &field_meta).content,
                         "$1,844.3".to_owned()
                     );
                 }
                 NumberFormat::Yen => {
                     assert_eq!(
-                        type_option.decode_cell_data(data("18443"), &field_meta),
+                        type_option.decode_cell_data(data("18443"), &field_meta).content,
                         "¥1,844.3".to_owned()
                     );
                 }
                 NumberFormat::EUR => {
                     assert_eq!(
-                        type_option.decode_cell_data(data("18443"), &field_meta),
+                        type_option.decode_cell_data(data("18443"), &field_meta).content,
                         "€1.844,3".to_owned()
                     );
                 }
@@ -737,25 +748,25 @@ mod tests {
             match format {
                 NumberFormat::Number => {
                     assert_eq!(
-                        type_option.decode_cell_data(data("18443"), &field_meta),
+                        type_option.decode_cell_data(data("18443"), &field_meta).content,
                         "18443".to_owned()
                     );
                 }
                 NumberFormat::USD => {
                     assert_eq!(
-                        type_option.decode_cell_data(data("18443"), &field_meta),
+                        type_option.decode_cell_data(data("18443"), &field_meta).content,
                         "-$18,443".to_owned()
                     );
                 }
                 NumberFormat::Yen => {
                     assert_eq!(
-                        type_option.decode_cell_data(data("18443"), &field_meta),
+                        type_option.decode_cell_data(data("18443"), &field_meta).content,
                         "-¥18,443".to_owned()
                     );
                 }
                 NumberFormat::EUR => {
                     assert_eq!(
-                        type_option.decode_cell_data(data("18443"), &field_meta),
+                        type_option.decode_cell_data(data("18443"), &field_meta).content,
                         "-€18.443".to_owned()
                     );
                 }

+ 73 - 88
frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option.rs

@@ -1,7 +1,8 @@
 use crate::impl_type_option;
 use crate::services::entities::{CellIdentifier, CellIdentifierPayload};
+use crate::services::field::type_options::util::get_cell_data;
 use crate::services::field::{BoxTypeOptionBuilder, TypeOptionBuilder};
-use crate::services::row::{CellDataChangeset, CellDataOperation, DecodedCellData, TypeOptionCellData};
+use crate::services::row::{CellContentChangeset, CellDataOperation, DecodedCellData, TypeOptionCellData};
 use bytes::Bytes;
 use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
 use flowy_error::{ErrorCode, FlowyError, FlowyResult};
@@ -112,13 +113,13 @@ impl CellDataOperation for SingleSelectTypeOption {
         DecodedCellData::default()
     }
 
-    fn apply_changeset<T: Into<CellDataChangeset>>(
+    fn apply_changeset<T: Into<CellContentChangeset>>(
         &self,
         changeset: T,
         _cell_meta: Option<CellMeta>,
     ) -> Result<String, FlowyError> {
         let changeset = changeset.into();
-        let select_option_changeset: SelectOptionCellChangeset = serde_json::from_str(&changeset)?;
+        let select_option_changeset: SelectOptionCellContentChangeset = serde_json::from_str(&changeset)?;
         let new_cell_data: String;
         if let Some(insert_option_id) = select_option_changeset.insert_option_id {
             tracing::trace!("Insert single select option: {}", &insert_option_id);
@@ -165,15 +166,6 @@ pub struct MultiSelectTypeOption {
 }
 impl_type_option!(MultiSelectTypeOption, FieldType::MultiSelect);
 
-impl MultiSelectTypeOption {
-    pub fn get_cell_data(&self, cell_meta: &CellMeta) -> String {
-        match TypeOptionCellData::from_str(&cell_meta.data) {
-            Ok(type_option) => type_option.data,
-            Err(_) => String::new(),
-        }
-    }
-}
-
 impl SelectOptionOperation for MultiSelectTypeOption {
     fn option_context(&self, cell_meta: &Option<CellMeta>) -> SelectOptionContext {
         let select_options = make_select_context_from(cell_meta, &self.options);
@@ -212,24 +204,21 @@ impl CellDataOperation for MultiSelectTypeOption {
         }
     }
 
-    fn apply_changeset<T: Into<CellDataChangeset>>(
+    fn apply_changeset<T: Into<CellContentChangeset>>(
         &self,
         changeset: T,
         cell_meta: Option<CellMeta>,
     ) -> Result<String, FlowyError> {
-        let changeset = changeset.into();
-        let select_option_changeset: SelectOptionCellChangeset = serde_json::from_str(&changeset)?;
+        let content_changeset: SelectOptionCellContentChangeset = serde_json::from_str(&changeset.into())?;
         let new_cell_data: String;
         match cell_meta {
             None => {
-                new_cell_data = select_option_changeset
-                    .insert_option_id
-                    .unwrap_or_else(|| "".to_owned());
+                new_cell_data = content_changeset.insert_option_id.unwrap_or_else(|| "".to_owned());
             }
             Some(cell_meta) => {
-                let cell_data = self.get_cell_data(&cell_meta);
+                let cell_data = get_cell_data(&cell_meta);
                 let mut selected_options = select_option_ids(cell_data);
-                if let Some(insert_option_id) = select_option_changeset.insert_option_id {
+                if let Some(insert_option_id) = content_changeset.insert_option_id {
                     tracing::trace!("Insert multi select option: {}", &insert_option_id);
                     if selected_options.contains(&insert_option_id) {
                         selected_options.retain(|id| id != &insert_option_id);
@@ -238,7 +227,7 @@ impl CellDataOperation for MultiSelectTypeOption {
                     }
                 }
 
-                if let Some(delete_option_id) = select_option_changeset.delete_option_id {
+                if let Some(delete_option_id) = content_changeset.delete_option_id {
                     tracing::trace!("Delete multi select option: {}", &delete_option_id);
                     selected_options.retain(|id| id != &delete_option_id);
                 }
@@ -348,68 +337,33 @@ impl TryInto<SelectOptionChangeset> for SelectOptionChangesetPayload {
 #[derive(Clone, Debug, Default, ProtoBuf)]
 pub struct SelectOptionCellChangesetPayload {
     #[pb(index = 1)]
-    pub grid_id: String,
-
-    #[pb(index = 2)]
-    pub row_id: String,
-
-    #[pb(index = 3)]
-    pub field_id: String,
+    pub cell_identifier: CellIdentifierPayload,
 
-    #[pb(index = 4, one_of)]
+    #[pb(index = 2, one_of)]
     pub insert_option_id: Option<String>,
 
-    #[pb(index = 5, one_of)]
+    #[pb(index = 3, one_of)]
     pub delete_option_id: Option<String>,
 }
 
 pub struct SelectOptionCellChangesetParams {
-    pub grid_id: String,
-    pub field_id: String,
-    pub row_id: String,
-    pub insert_option_id: Option<String>,
-
-    pub delete_option_id: Option<String>,
-}
-
-#[derive(Clone, Serialize, Deserialize)]
-pub struct SelectOptionCellChangeset {
+    pub cell_identifier: CellIdentifier,
     pub insert_option_id: Option<String>,
     pub delete_option_id: Option<String>,
 }
 
-impl SelectOptionCellChangeset {
-    pub fn from_insert(option_id: &str) -> Self {
-        SelectOptionCellChangeset {
-            insert_option_id: Some(option_id.to_string()),
-            delete_option_id: None,
-        }
-    }
-
-    pub fn from_delete(option_id: &str) -> Self {
-        SelectOptionCellChangeset {
-            insert_option_id: None,
-            delete_option_id: Some(option_id.to_string()),
-        }
-    }
-
-    pub fn cell_data(&self) -> String {
-        serde_json::to_string(self).unwrap()
-    }
-}
-
 impl std::convert::From<SelectOptionCellChangesetParams> for CellChangeset {
     fn from(params: SelectOptionCellChangesetParams) -> Self {
-        let changeset = SelectOptionCellChangeset {
+        let changeset = SelectOptionCellContentChangeset {
             insert_option_id: params.insert_option_id,
             delete_option_id: params.delete_option_id,
         };
         let s = serde_json::to_string(&changeset).unwrap();
         CellChangeset {
-            grid_id: params.grid_id,
-            row_id: params.row_id,
-            field_id: params.field_id,
-            data: Some(s),
+            grid_id: params.cell_identifier.grid_id,
+            row_id: params.cell_identifier.row_id,
+            field_id: params.cell_identifier.field_id,
+            cell_content_changeset: Some(s),
         }
     }
 }
@@ -418,9 +372,7 @@ impl TryInto<SelectOptionCellChangesetParams> for SelectOptionCellChangesetPaylo
     type Error = ErrorCode;
 
     fn try_into(self) -> Result<SelectOptionCellChangesetParams, Self::Error> {
-        let grid_id = NotEmptyStr::parse(self.grid_id).map_err(|_| ErrorCode::GridIdIsEmpty)?;
-        let row_id = NotEmptyStr::parse(self.row_id).map_err(|_| ErrorCode::RowIdIsEmpty)?;
-        let field_id = NotEmptyStr::parse(self.field_id).map_err(|_| ErrorCode::FieldIdIsEmpty)?;
+        let cell_identifier: CellIdentifier = self.cell_identifier.try_into()?;
         let insert_option_id = match self.insert_option_id {
             None => None,
             Some(insert_option_id) => Some(
@@ -440,15 +392,39 @@ impl TryInto<SelectOptionCellChangesetParams> for SelectOptionCellChangesetPaylo
         };
 
         Ok(SelectOptionCellChangesetParams {
-            grid_id: grid_id.0,
-            row_id: row_id.0,
-            field_id: field_id.0,
+            cell_identifier,
             insert_option_id,
             delete_option_id,
         })
     }
 }
 
+#[derive(Clone, Serialize, Deserialize)]
+pub struct SelectOptionCellContentChangeset {
+    pub insert_option_id: Option<String>,
+    pub delete_option_id: Option<String>,
+}
+
+impl SelectOptionCellContentChangeset {
+    pub fn from_insert(option_id: &str) -> Self {
+        SelectOptionCellContentChangeset {
+            insert_option_id: Some(option_id.to_string()),
+            delete_option_id: None,
+        }
+    }
+
+    pub fn from_delete(option_id: &str) -> Self {
+        SelectOptionCellContentChangeset {
+            insert_option_id: None,
+            delete_option_id: Some(option_id.to_string()),
+        }
+    }
+
+    pub fn to_str(&self) -> String {
+        serde_json::to_string(self).unwrap()
+    }
+}
+
 #[derive(Clone, Debug, Default, Serialize, Deserialize, ProtoBuf)]
 pub struct SelectOptionContext {
     #[pb(index = 1)]
@@ -513,7 +489,7 @@ fn make_select_context_from(cell_meta: &Option<CellMeta>, options: &[SelectOptio
 mod tests {
     use crate::services::field::FieldBuilder;
     use crate::services::field::{
-        MultiSelectTypeOption, MultiSelectTypeOptionBuilder, SelectOption, SelectOptionCellChangeset,
+        MultiSelectTypeOption, MultiSelectTypeOptionBuilder, SelectOption, SelectOptionCellContentChangeset,
         SingleSelectTypeOption, SingleSelectTypeOptionBuilder, SELECTION_IDS_SEPARATOR,
     };
     use crate::services::row::CellDataOperation;
@@ -536,25 +512,31 @@ mod tests {
         let type_option = SingleSelectTypeOption::from(&field_meta);
 
         let option_ids = vec![google_option.id.clone(), facebook_option.id].join(SELECTION_IDS_SEPARATOR);
-        let data = SelectOptionCellChangeset::from_insert(&option_ids).cell_data();
+        let data = SelectOptionCellContentChangeset::from_insert(&option_ids).to_str();
         let cell_data = type_option.apply_changeset(data, None).unwrap();
-        assert_eq!(type_option.decode_cell_data(cell_data, &field_meta), google_option.name,);
+        assert_eq!(
+            type_option.decode_cell_data(cell_data, &field_meta).content,
+            google_option.name,
+        );
 
-        let data = SelectOptionCellChangeset::from_insert(&google_option.id).cell_data();
+        let data = SelectOptionCellContentChangeset::from_insert(&google_option.id).to_str();
         let cell_data = type_option.apply_changeset(data, None).unwrap();
-        assert_eq!(type_option.decode_cell_data(cell_data, &field_meta), google_option.name,);
+        assert_eq!(
+            type_option.decode_cell_data(cell_data, &field_meta).content,
+            google_option.name,
+        );
 
         // Invalid option id
         let cell_data = type_option
-            .apply_changeset(SelectOptionCellChangeset::from_insert("").cell_data(), None)
+            .apply_changeset(SelectOptionCellContentChangeset::from_insert("").to_str(), None)
             .unwrap();
-        assert_eq!(type_option.decode_cell_data(cell_data, &field_meta), "",);
+        assert_eq!(type_option.decode_cell_data(cell_data, &field_meta).content, "",);
 
         // Invalid option id
         let cell_data = type_option
-            .apply_changeset(SelectOptionCellChangeset::from_insert("123").cell_data(), None)
+            .apply_changeset(SelectOptionCellContentChangeset::from_insert("123").to_str(), None)
             .unwrap();
-        assert_eq!(type_option.decode_cell_data(cell_data, &field_meta), "",);
+        assert_eq!(type_option.decode_cell_data(cell_data, &field_meta).content, "",);
 
         // Invalid changeset
         assert!(type_option.apply_changeset("123", None).is_err());
@@ -578,28 +560,31 @@ mod tests {
         let type_option = MultiSelectTypeOption::from(&field_meta);
 
         let option_ids = vec![google_option.id.clone(), facebook_option.id.clone()].join(SELECTION_IDS_SEPARATOR);
-        let data = SelectOptionCellChangeset::from_insert(&option_ids).cell_data();
+        let data = SelectOptionCellContentChangeset::from_insert(&option_ids).to_str();
         let cell_data = type_option.apply_changeset(data, None).unwrap();
         assert_eq!(
-            type_option.decode_cell_data(cell_data, &field_meta),
+            type_option.decode_cell_data(cell_data, &field_meta).content,
             vec![google_option.name.clone(), facebook_option.name].join(SELECTION_IDS_SEPARATOR),
         );
 
-        let data = SelectOptionCellChangeset::from_insert(&google_option.id).cell_data();
+        let data = SelectOptionCellContentChangeset::from_insert(&google_option.id).to_str();
         let cell_data = type_option.apply_changeset(data, None).unwrap();
-        assert_eq!(type_option.decode_cell_data(cell_data, &field_meta), google_option.name,);
+        assert_eq!(
+            type_option.decode_cell_data(cell_data, &field_meta).content,
+            google_option.name,
+        );
 
         // Invalid option id
         let cell_data = type_option
-            .apply_changeset(SelectOptionCellChangeset::from_insert("").cell_data(), None)
+            .apply_changeset(SelectOptionCellContentChangeset::from_insert("").to_str(), None)
             .unwrap();
-        assert_eq!(type_option.decode_cell_data(cell_data, &field_meta), "",);
+        assert_eq!(type_option.decode_cell_data(cell_data, &field_meta).content, "",);
 
         // Invalid option id
         let cell_data = type_option
-            .apply_changeset(SelectOptionCellChangeset::from_insert("123,456").cell_data(), None)
+            .apply_changeset(SelectOptionCellContentChangeset::from_insert("123,456").to_str(), None)
             .unwrap();
-        assert_eq!(type_option.decode_cell_data(cell_data, &field_meta), "",);
+        assert_eq!(type_option.decode_cell_data(cell_data, &field_meta).content, "",);
 
         // Invalid changeset
         assert!(type_option.apply_changeset("123", None).is_err());

+ 12 - 9
frontend/rust-lib/flowy-grid/src/services/field/type_options/text_type_option.rs

@@ -1,7 +1,7 @@
 use crate::impl_type_option;
 use crate::services::field::{BoxTypeOptionBuilder, TypeOptionBuilder};
 use crate::services::row::{
-    decode_cell_data, CellDataChangeset, CellDataOperation, DecodedCellData, TypeOptionCellData,
+    decode_cell_data, CellContentChangeset, CellDataOperation, DecodedCellData, TypeOptionCellData,
 };
 use bytes::Bytes;
 use flowy_derive::ProtoBuf;
@@ -42,8 +42,7 @@ impl CellDataOperation for RichTextTypeOption {
                 || type_option_cell_data.is_multi_select()
                 || type_option_cell_data.is_number()
             {
-                decode_cell_data(data, field_meta, &type_option_cell_data.field_type)
-                    .unwrap_or_else(|| DecodedCellData::default())
+                decode_cell_data(data, field_meta, &type_option_cell_data.field_type).unwrap_or_default()
             } else {
                 DecodedCellData::from_content(type_option_cell_data.data)
             }
@@ -52,7 +51,7 @@ impl CellDataOperation for RichTextTypeOption {
         }
     }
 
-    fn apply_changeset<T: Into<CellDataChangeset>>(
+    fn apply_changeset<T: Into<CellContentChangeset>>(
         &self,
         changeset: T,
         _cell_meta: Option<CellMeta>,
@@ -81,7 +80,7 @@ mod tests {
         let date_time_field_meta = FieldBuilder::from_field_type(&FieldType::DateTime).build();
         let data = TypeOptionCellData::new("1647251762", FieldType::DateTime).json();
         assert_eq!(
-            type_option.decode_cell_data(data, &date_time_field_meta),
+            type_option.decode_cell_data(data, &date_time_field_meta).content,
             "Mar 14,2022".to_owned()
         );
 
@@ -92,7 +91,9 @@ mod tests {
         let single_select_field_meta = FieldBuilder::new(single_select).build();
         let cell_data = TypeOptionCellData::new(&done_option_id, FieldType::SingleSelect).json();
         assert_eq!(
-            type_option.decode_cell_data(cell_data, &single_select_field_meta),
+            type_option
+                .decode_cell_data(cell_data, &single_select_field_meta)
+                .content,
             "Done".to_owned()
         );
 
@@ -100,7 +101,7 @@ mod tests {
         let google_option = SelectOption::new("Google");
         let facebook_option = SelectOption::new("Facebook");
         let ids = vec![google_option.id.clone(), facebook_option.id.clone()].join(SELECTION_IDS_SEPARATOR);
-        let cell_data_changeset = SelectOptionCellChangeset::from_insert(&ids).cell_data();
+        let cell_data_changeset = SelectOptionCellContentChangeset::from_insert(&ids).to_str();
         let multi_select = MultiSelectTypeOptionBuilder::default()
             .option(google_option)
             .option(facebook_option);
@@ -108,7 +109,9 @@ mod tests {
         let multi_type_option = MultiSelectTypeOption::from(&multi_select_field_meta);
         let cell_data = multi_type_option.apply_changeset(cell_data_changeset, None).unwrap();
         assert_eq!(
-            type_option.decode_cell_data(cell_data, &multi_select_field_meta),
+            type_option
+                .decode_cell_data(cell_data, &multi_select_field_meta)
+                .content,
             "Google,Facebook".to_owned()
         );
 
@@ -117,7 +120,7 @@ mod tests {
         let number_field_meta = FieldBuilder::new(number).build();
         let data = TypeOptionCellData::new("18443", FieldType::Number).json();
         assert_eq!(
-            type_option.decode_cell_data(data, &number_field_meta),
+            type_option.decode_cell_data(data, &number_field_meta).content,
             "$18,443".to_owned()
         );
     }

+ 0 - 1
frontend/rust-lib/flowy-grid/src/services/field/type_options/type_option_data.rs

@@ -1 +0,0 @@
-

+ 10 - 0
frontend/rust-lib/flowy-grid/src/services/field/type_options/util.rs

@@ -0,0 +1,10 @@
+use crate::services::row::TypeOptionCellData;
+use flowy_grid_data_model::entities::CellMeta;
+use std::str::FromStr;
+
+pub fn get_cell_data(cell_meta: &CellMeta) -> String {
+    match TypeOptionCellData::from_str(&cell_meta.data) {
+        Ok(type_option) => type_option.data,
+        Err(_) => String::new(),
+    }
+}

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

@@ -117,7 +117,7 @@ impl ClientGridEditor {
                 Ok(grid.update_field_meta(changeset, deserializer)?)
             })
             .await?;
-        let _ = self.notify_did_update_grid_field(&field_id).await?;
+        let _ = self.notify_did_update_grid_field(field_id).await?;
         Ok(())
     }
 
@@ -337,30 +337,45 @@ impl ClientGridEditor {
     }
 
     #[tracing::instrument(level = "trace", skip_all, err)]
-    pub async fn update_cell(&self, mut changeset: CellChangeset) -> FlowyResult<()> {
-        if changeset.data.as_ref().is_none() {
+    pub async fn update_cell(&self, mut cell_changeset: CellChangeset) -> FlowyResult<()> {
+        if cell_changeset.cell_content_changeset.as_ref().is_none() {
             return Ok(());
         }
 
-        let cell_data_changeset = changeset.data.unwrap();
-        let cell_meta = self.get_cell_meta(&changeset.row_id, &changeset.field_id).await?;
-        tracing::trace!(
-            "field changeset: id:{} / value:{}",
-            &changeset.field_id,
-            cell_data_changeset
-        );
-        match self.grid_pad.read().await.get_field_meta(&changeset.field_id) {
+        let CellChangeset {
+            grid_id,
+            row_id,
+            field_id,
+            mut cell_content_changeset,
+        } = cell_changeset;
+
+        match self.grid_pad.read().await.get_field_meta(&field_id) {
             None => {
-                let msg = format!("Field not found with id: {}", &changeset.field_id);
+                let msg = format!("Field not found with id: {}", &field_id);
                 Err(FlowyError::internal().context(msg))
             }
             Some((_, field_meta)) => {
+                tracing::trace!("field changeset: id:{} / value:{:?}", &field_id, cell_content_changeset);
+
+                let cell_meta = self.get_cell_meta(&row_id, &field_id).await?;
                 // Update the changeset.data property with the return value.
-                changeset.data = Some(apply_cell_data_changeset(cell_data_changeset, cell_meta, field_meta)?);
+                cell_content_changeset = Some(apply_cell_data_changeset(
+                    cell_content_changeset.unwrap(),
+                    cell_meta,
+                    field_meta,
+                )?);
                 let field_metas = self.get_field_metas::<FieldOrder>(None).await?;
+                let cell_changeset = CellChangeset {
+                    grid_id,
+                    row_id,
+                    field_id,
+                    cell_content_changeset,
+                };
                 let _ = self
                     .block_meta_manager
-                    .update_cell(changeset, |row_meta| make_row_from_row_meta(&field_metas, row_meta))
+                    .update_cell(cell_changeset, |row_meta| {
+                        make_row_from_row_meta(&field_metas, row_meta)
+                    })
                     .await?;
                 Ok(())
             }

+ 31 - 34
frontend/rust-lib/flowy-grid/src/services/row/cell_data_operation.rs

@@ -1,15 +1,12 @@
 use crate::services::field::*;
-use std::borrow::Cow;
-use std::fmt::Formatter;
-use std::sync::Arc;
-
 use flowy_error::FlowyError;
 use flowy_grid_data_model::entities::{CellMeta, FieldMeta, FieldType};
 use serde::{Deserialize, Serialize};
+use std::fmt::Formatter;
 
 pub trait CellDataOperation {
     fn decode_cell_data(&self, data: String, field_meta: &FieldMeta) -> DecodedCellData;
-    fn apply_changeset<T: Into<CellDataChangeset>>(
+    fn apply_changeset<T: Into<CellContentChangeset>>(
         &self,
         changeset: T,
         cell_meta: Option<CellMeta>,
@@ -17,22 +14,22 @@ pub trait CellDataOperation {
 }
 
 #[derive(Debug)]
-pub struct CellDataChangeset(String);
+pub struct CellContentChangeset(String);
 
-impl std::fmt::Display for CellDataChangeset {
+impl std::fmt::Display for CellContentChangeset {
     fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
         write!(f, "{}", &self.0)
     }
 }
 
-impl<T: AsRef<str>> std::convert::From<T> for CellDataChangeset {
+impl<T: AsRef<str>> std::convert::From<T> for CellContentChangeset {
     fn from(s: T) -> Self {
         let s = s.as_ref().to_owned();
-        CellDataChangeset(s)
+        CellContentChangeset(s)
     }
 }
 
-impl std::ops::Deref for CellDataChangeset {
+impl std::ops::Deref for CellContentChangeset {
     type Target = str;
 
     fn deref(&self) -> &Self::Target {
@@ -94,7 +91,7 @@ impl TypeOptionCellData {
 
 /// The changeset will be deserialized into specific data base on the FieldType.
 /// For example, it's String on FieldType::RichText, and SelectOptionChangeset on FieldType::SingleSelect
-pub fn apply_cell_data_changeset<T: Into<CellDataChangeset>>(
+pub fn apply_cell_data_changeset<T: Into<CellContentChangeset>>(
     changeset: T,
     cell_meta: Option<CellMeta>,
     field_meta: &FieldMeta,
@@ -109,29 +106,6 @@ pub fn apply_cell_data_changeset<T: Into<CellDataChangeset>>(
     }
 }
 
-#[derive(Default)]
-pub struct DecodedCellData {
-    raw: String,
-    content: String,
-}
-
-impl DecodedCellData {
-    pub fn from_content(content: String) -> Self {
-        Self {
-            raw: content.clone(),
-            content,
-        }
-    }
-
-    pub fn new(raw: String, content: String) -> Self {
-        Self { raw, content }
-    }
-
-    pub fn split(self) -> (String, String) {
-        (self.raw, self.content)
-    }
-}
-
 pub fn decode_cell_data(data: String, field_meta: &FieldMeta, field_type: &FieldType) -> Option<DecodedCellData> {
     let s = match field_type {
         FieldType::RichText => field_meta
@@ -159,3 +133,26 @@ pub fn decode_cell_data(data: String, field_meta: &FieldMeta, field_type: &Field
     );
     Some(s)
 }
+
+#[derive(Default)]
+pub struct DecodedCellData {
+    pub raw: String,
+    pub content: String,
+}
+
+impl DecodedCellData {
+    pub fn from_content(content: String) -> Self {
+        Self {
+            raw: content.clone(),
+            content,
+        }
+    }
+
+    pub fn new(raw: String, content: String) -> Self {
+        Self { raw, content }
+    }
+
+    pub fn split(self) -> (String, String) {
+        (self.raw, self.content)
+    }
+}

+ 2 - 2
frontend/rust-lib/flowy-grid/src/services/row/row_builder.rs

@@ -1,4 +1,4 @@
-use crate::services::field::SelectOptionCellChangeset;
+use crate::services::field::SelectOptionCellContentChangeset;
 use crate::services::row::apply_cell_data_changeset;
 use flowy_error::{FlowyError, FlowyResult};
 use flowy_grid_data_model::entities::{gen_row_id, CellMeta, FieldMeta, RowMeta, DEFAULT_ROW_HEIGHT};
@@ -52,7 +52,7 @@ impl<'a> CreateRowMetaBuilder<'a> {
                 Err(FlowyError::internal().context(msg))
             }
             Some(field_meta) => {
-                let cell_data = SelectOptionCellChangeset::from_insert(&data).cell_data();
+                let cell_data = SelectOptionCellContentChangeset::from_insert(&data).to_str();
                 let data = apply_cell_data_changeset(&cell_data, None, field_meta)?;
                 let cell = CellMeta::new(data);
                 self.payload.cell_by_field_id.insert(field_id.to_owned(), cell);

+ 2 - 2
frontend/rust-lib/flowy-grid/src/services/row/row_loader.rs

@@ -31,14 +31,14 @@ pub fn make_cell_by_field_id(
     cell_meta: CellMeta,
 ) -> Option<(String, Cell)> {
     let field_meta = field_map.get(&field_id)?;
-    let (raw, content) = decode_cell_data(cell_meta.data.clone(), field_meta, &field_meta.field_type)?.split();
+    let (raw, content) = decode_cell_data(cell_meta.data, field_meta, &field_meta.field_type)?.split();
     let cell = Cell::new(&field_id, content, raw);
     Some((field_id, cell))
 }
 
 pub fn make_cell(field_id: &str, field_meta: &FieldMeta, row_meta: &RowMeta) -> Option<Cell> {
     let cell_meta = row_meta.cells.get(field_id)?.clone();
-    let (raw, content) = decode_cell_data(cell_meta.data.clone(), field_meta, &field_meta.field_type)?.split();
+    let (raw, content) = decode_cell_data(cell_meta.data, field_meta, &field_meta.field_type)?.split();
     Some(Cell::new(field_id, content, raw))
 }
 

+ 8 - 7
frontend/rust-lib/flowy-grid/tests/grid/grid_test.rs

@@ -2,7 +2,8 @@ use crate::grid::script::EditorScript::*;
 use crate::grid::script::*;
 use chrono::NaiveDateTime;
 use flowy_grid::services::field::{
-    MultiSelectTypeOption, SelectOption, SelectOptionCellChangeset, SingleSelectTypeOption, SELECTION_IDS_SEPARATOR,
+    MultiSelectTypeOption, SelectOption, SelectOptionCellContentChangeset, SingleSelectTypeOption,
+    SELECTION_IDS_SEPARATOR,
 };
 use flowy_grid::services::row::{decode_cell_data, CreateRowMetaBuilder};
 use flowy_grid_data_model::entities::{
@@ -317,11 +318,11 @@ async fn grid_cell_update() {
                     FieldType::DateTime => "123".to_string(),
                     FieldType::SingleSelect => {
                         let type_option = SingleSelectTypeOption::from(field_meta);
-                        SelectOptionCellChangeset::from_insert(&type_option.options.first().unwrap().id).cell_data()
+                        SelectOptionCellContentChangeset::from_insert(&type_option.options.first().unwrap().id).to_str()
                     }
                     FieldType::MultiSelect => {
                         let type_option = MultiSelectTypeOption::from(field_meta);
-                        SelectOptionCellChangeset::from_insert(&type_option.options.first().unwrap().id).cell_data()
+                        SelectOptionCellContentChangeset::from_insert(&type_option.options.first().unwrap().id).to_str()
                     }
                     FieldType::Checkbox => "1".to_string(),
                 };
@@ -331,7 +332,7 @@ async fn grid_cell_update() {
                         grid_id: block_id.to_string(),
                         row_id: row_meta.id.clone(),
                         field_id: field_meta.id.clone(),
-                        data: Some(data),
+                        cell_content_changeset: Some(data),
                     },
                     is_err: false,
                 });
@@ -342,8 +343,8 @@ async fn grid_cell_update() {
                     FieldType::RichText => ("1".to_string().repeat(10001), true),
                     FieldType::Number => ("abc".to_string(), true),
                     FieldType::DateTime => ("abc".to_string(), true),
-                    FieldType::SingleSelect => (SelectOptionCellChangeset::from_insert("abc").cell_data(), false),
-                    FieldType::MultiSelect => (SelectOptionCellChangeset::from_insert("abc").cell_data(), false),
+                    FieldType::SingleSelect => (SelectOptionCellContentChangeset::from_insert("abc").to_str(), false),
+                    FieldType::MultiSelect => (SelectOptionCellContentChangeset::from_insert("abc").to_str(), false),
                     FieldType::Checkbox => ("2".to_string(), false),
                 };
 
@@ -352,7 +353,7 @@ async fn grid_cell_update() {
                         grid_id: block_id.to_string(),
                         row_id: row_meta.id.clone(),
                         field_id: field_meta.id.clone(),
-                        data: Some(data),
+                        cell_content_changeset: Some(data),
                     },
                     is_err,
                 });

+ 2 - 2
shared-lib/flowy-grid-data-model/src/entities/grid.rs

@@ -902,7 +902,7 @@ pub struct CellChangeset {
     pub field_id: String,
 
     #[pb(index = 4, one_of)]
-    pub data: Option<String>,
+    pub cell_content_changeset: Option<String>,
 }
 
 impl std::convert::From<CellChangeset> for RowMetaChangeset {
@@ -910,7 +910,7 @@ impl std::convert::From<CellChangeset> for RowMetaChangeset {
         let mut cell_by_field_id = HashMap::with_capacity(1);
         let field_id = changeset.field_id;
         let cell_meta = CellMeta {
-            data: changeset.data.unwrap_or_else(|| "".to_owned()),
+            data: changeset.cell_content_changeset.unwrap_or_else(|| "".to_owned()),
         };
         cell_by_field_id.insert(field_id, cell_meta);
 

+ 41 - 40
shared-lib/flowy-grid-data-model/src/protobuf/model/grid.rs

@@ -7803,7 +7803,7 @@ pub struct CellChangeset {
     pub row_id: ::std::string::String,
     pub field_id: ::std::string::String,
     // message oneof groups
-    pub one_of_data: ::std::option::Option<CellChangeset_oneof_one_of_data>,
+    pub one_of_cell_content_changeset: ::std::option::Option<CellChangeset_oneof_one_of_cell_content_changeset>,
     // special fields
     pub unknown_fields: ::protobuf::UnknownFields,
     pub cached_size: ::protobuf::CachedSize,
@@ -7816,8 +7816,8 @@ impl<'a> ::std::default::Default for &'a CellChangeset {
 }
 
 #[derive(Clone,PartialEq,Debug)]
-pub enum CellChangeset_oneof_one_of_data {
-    data(::std::string::String),
+pub enum CellChangeset_oneof_one_of_cell_content_changeset {
+    cell_content_changeset(::std::string::String),
 }
 
 impl CellChangeset {
@@ -7903,48 +7903,48 @@ impl CellChangeset {
         ::std::mem::replace(&mut self.field_id, ::std::string::String::new())
     }
 
-    // string data = 4;
+    // string cell_content_changeset = 4;
 
 
-    pub fn get_data(&self) -> &str {
-        match self.one_of_data {
-            ::std::option::Option::Some(CellChangeset_oneof_one_of_data::data(ref v)) => v,
+    pub fn get_cell_content_changeset(&self) -> &str {
+        match self.one_of_cell_content_changeset {
+            ::std::option::Option::Some(CellChangeset_oneof_one_of_cell_content_changeset::cell_content_changeset(ref v)) => v,
             _ => "",
         }
     }
-    pub fn clear_data(&mut self) {
-        self.one_of_data = ::std::option::Option::None;
+    pub fn clear_cell_content_changeset(&mut self) {
+        self.one_of_cell_content_changeset = ::std::option::Option::None;
     }
 
-    pub fn has_data(&self) -> bool {
-        match self.one_of_data {
-            ::std::option::Option::Some(CellChangeset_oneof_one_of_data::data(..)) => true,
+    pub fn has_cell_content_changeset(&self) -> bool {
+        match self.one_of_cell_content_changeset {
+            ::std::option::Option::Some(CellChangeset_oneof_one_of_cell_content_changeset::cell_content_changeset(..)) => true,
             _ => false,
         }
     }
 
     // Param is passed by value, moved
-    pub fn set_data(&mut self, v: ::std::string::String) {
-        self.one_of_data = ::std::option::Option::Some(CellChangeset_oneof_one_of_data::data(v))
+    pub fn set_cell_content_changeset(&mut self, v: ::std::string::String) {
+        self.one_of_cell_content_changeset = ::std::option::Option::Some(CellChangeset_oneof_one_of_cell_content_changeset::cell_content_changeset(v))
     }
 
     // Mutable pointer to the field.
-    pub fn mut_data(&mut self) -> &mut ::std::string::String {
-        if let ::std::option::Option::Some(CellChangeset_oneof_one_of_data::data(_)) = self.one_of_data {
+    pub fn mut_cell_content_changeset(&mut self) -> &mut ::std::string::String {
+        if let ::std::option::Option::Some(CellChangeset_oneof_one_of_cell_content_changeset::cell_content_changeset(_)) = self.one_of_cell_content_changeset {
         } else {
-            self.one_of_data = ::std::option::Option::Some(CellChangeset_oneof_one_of_data::data(::std::string::String::new()));
+            self.one_of_cell_content_changeset = ::std::option::Option::Some(CellChangeset_oneof_one_of_cell_content_changeset::cell_content_changeset(::std::string::String::new()));
         }
-        match self.one_of_data {
-            ::std::option::Option::Some(CellChangeset_oneof_one_of_data::data(ref mut v)) => v,
+        match self.one_of_cell_content_changeset {
+            ::std::option::Option::Some(CellChangeset_oneof_one_of_cell_content_changeset::cell_content_changeset(ref mut v)) => v,
             _ => panic!(),
         }
     }
 
     // Take field
-    pub fn take_data(&mut self) -> ::std::string::String {
-        if self.has_data() {
-            match self.one_of_data.take() {
-                ::std::option::Option::Some(CellChangeset_oneof_one_of_data::data(v)) => v,
+    pub fn take_cell_content_changeset(&mut self) -> ::std::string::String {
+        if self.has_cell_content_changeset() {
+            match self.one_of_cell_content_changeset.take() {
+                ::std::option::Option::Some(CellChangeset_oneof_one_of_cell_content_changeset::cell_content_changeset(v)) => v,
                 _ => panic!(),
             }
         } else {
@@ -7975,7 +7975,7 @@ impl ::protobuf::Message for CellChangeset {
                     if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited {
                         return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
                     }
-                    self.one_of_data = ::std::option::Option::Some(CellChangeset_oneof_one_of_data::data(is.read_string()?));
+                    self.one_of_cell_content_changeset = ::std::option::Option::Some(CellChangeset_oneof_one_of_cell_content_changeset::cell_content_changeset(is.read_string()?));
                 },
                 _ => {
                     ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
@@ -7998,9 +7998,9 @@ impl ::protobuf::Message for CellChangeset {
         if !self.field_id.is_empty() {
             my_size += ::protobuf::rt::string_size(3, &self.field_id);
         }
-        if let ::std::option::Option::Some(ref v) = self.one_of_data {
+        if let ::std::option::Option::Some(ref v) = self.one_of_cell_content_changeset {
             match v {
-                &CellChangeset_oneof_one_of_data::data(ref v) => {
+                &CellChangeset_oneof_one_of_cell_content_changeset::cell_content_changeset(ref v) => {
                     my_size += ::protobuf::rt::string_size(4, &v);
                 },
             };
@@ -8020,9 +8020,9 @@ impl ::protobuf::Message for CellChangeset {
         if !self.field_id.is_empty() {
             os.write_string(3, &self.field_id)?;
         }
-        if let ::std::option::Option::Some(ref v) = self.one_of_data {
+        if let ::std::option::Option::Some(ref v) = self.one_of_cell_content_changeset {
             match v {
-                &CellChangeset_oneof_one_of_data::data(ref v) => {
+                &CellChangeset_oneof_one_of_cell_content_changeset::cell_content_changeset(ref v) => {
                     os.write_string(4, v)?;
                 },
             };
@@ -8081,9 +8081,9 @@ impl ::protobuf::Message for CellChangeset {
                 |m: &mut CellChangeset| { &mut m.field_id },
             ));
             fields.push(::protobuf::reflect::accessor::make_singular_string_accessor::<_>(
-                "data",
-                CellChangeset::has_data,
-                CellChangeset::get_data,
+                "cell_content_changeset",
+                CellChangeset::has_cell_content_changeset,
+                CellChangeset::get_cell_content_changeset,
             ));
             ::protobuf::reflect::MessageDescriptor::new_pb_name::<CellChangeset>(
                 "CellChangeset",
@@ -8104,7 +8104,7 @@ impl ::protobuf::Clear for CellChangeset {
         self.grid_id.clear();
         self.row_id.clear();
         self.field_id.clear();
-        self.one_of_data = ::std::option::Option::None;
+        self.one_of_cell_content_changeset = ::std::option::Option::None;
         self.unknown_fields.clear();
     }
 }
@@ -8321,14 +8321,15 @@ static file_descriptor_proto_data: &'static [u8] = b"\
     \x01(\tR\x06gridId\x12\x17\n\x07item_id\x18\x02\x20\x01(\tR\x06itemId\
     \x12\x1d\n\nfrom_index\x18\x03\x20\x01(\x05R\tfromIndex\x12\x19\n\x08to_\
     index\x18\x04\x20\x01(\x05R\x07toIndex\x12\x1d\n\x02ty\x18\x05\x20\x01(\
-    \x0e2\r.MoveItemTypeR\x02ty\"\x7f\n\rCellChangeset\x12\x17\n\x07grid_id\
-    \x18\x01\x20\x01(\tR\x06gridId\x12\x15\n\x06row_id\x18\x02\x20\x01(\tR\
-    \x05rowId\x12\x19\n\x08field_id\x18\x03\x20\x01(\tR\x07fieldId\x12\x14\n\
-    \x04data\x18\x04\x20\x01(\tH\0R\x04dataB\r\n\x0bone_of_data**\n\x0cMoveI\
-    temType\x12\r\n\tMoveField\x10\0\x12\x0b\n\x07MoveRow\x10\x01*d\n\tField\
-    Type\x12\x0c\n\x08RichText\x10\0\x12\n\n\x06Number\x10\x01\x12\x0c\n\x08\
-    DateTime\x10\x02\x12\x10\n\x0cSingleSelect\x10\x03\x12\x0f\n\x0bMultiSel\
-    ect\x10\x04\x12\x0c\n\x08Checkbox\x10\x05b\x06proto3\
+    \x0e2\r.MoveItemTypeR\x02ty\"\xb3\x01\n\rCellChangeset\x12\x17\n\x07grid\
+    _id\x18\x01\x20\x01(\tR\x06gridId\x12\x15\n\x06row_id\x18\x02\x20\x01(\t\
+    R\x05rowId\x12\x19\n\x08field_id\x18\x03\x20\x01(\tR\x07fieldId\x126\n\
+    \x16cell_content_changeset\x18\x04\x20\x01(\tH\0R\x14cellContentChangese\
+    tB\x1f\n\x1done_of_cell_content_changeset**\n\x0cMoveItemType\x12\r\n\tM\
+    oveField\x10\0\x12\x0b\n\x07MoveRow\x10\x01*d\n\tFieldType\x12\x0c\n\x08\
+    RichText\x10\0\x12\n\n\x06Number\x10\x01\x12\x0c\n\x08DateTime\x10\x02\
+    \x12\x10\n\x0cSingleSelect\x10\x03\x12\x0f\n\x0bMultiSelect\x10\x04\x12\
+    \x0c\n\x08Checkbox\x10\x05b\x06proto3\
 ";
 
 static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;

+ 1 - 1
shared-lib/flowy-grid-data-model/src/protobuf/proto/grid.proto

@@ -153,7 +153,7 @@ message CellChangeset {
     string grid_id = 1;
     string row_id = 2;
     string field_id = 3;
-    oneof one_of_data { string data = 4; };
+    oneof one_of_cell_content_changeset { string cell_content_changeset = 4; };
 }
 enum MoveItemType {
     MoveField = 0;

+ 1 - 0
shared-lib/flowy-user-data-model/src/parser/user_email.rs

@@ -56,6 +56,7 @@ mod tests {
     impl quickcheck::Arbitrary for ValidEmailFixture {
         fn arbitrary(g: &mut quickcheck::Gen) -> Self {
             let mut rand_slice: [u8; 32] = [0; 32];
+            #[allow(clippy::needless_range_loop)]
             for i in 0..32 {
                 rand_slice[i] = u8::arbitrary(g);
             }