diff --git a/frontend/app_flowy/assets/images/grid/field/checkbox.svg b/frontend/app_flowy/assets/images/grid/field/checkbox.svg new file mode 100644 index 0000000000..37f52c47ed --- /dev/null +++ b/frontend/app_flowy/assets/images/grid/field/checkbox.svg @@ -0,0 +1,4 @@ + + + + diff --git a/frontend/app_flowy/assets/images/grid/field/checklist.svg b/frontend/app_flowy/assets/images/grid/field/checklist.svg new file mode 100644 index 0000000000..3a88d236a1 --- /dev/null +++ b/frontend/app_flowy/assets/images/grid/field/checklist.svg @@ -0,0 +1,4 @@ + + + + diff --git a/frontend/app_flowy/assets/images/grid/field/date.svg b/frontend/app_flowy/assets/images/grid/field/date.svg new file mode 100644 index 0000000000..78243f1e75 --- /dev/null +++ b/frontend/app_flowy/assets/images/grid/field/date.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/frontend/app_flowy/assets/images/grid/field/multi_select.svg b/frontend/app_flowy/assets/images/grid/field/multi_select.svg new file mode 100644 index 0000000000..97a2e9c434 --- /dev/null +++ b/frontend/app_flowy/assets/images/grid/field/multi_select.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/frontend/app_flowy/assets/images/grid/field/number.svg b/frontend/app_flowy/assets/images/grid/field/number.svg new file mode 100644 index 0000000000..9d8b98d10d --- /dev/null +++ b/frontend/app_flowy/assets/images/grid/field/number.svg @@ -0,0 +1,3 @@ + + + diff --git a/frontend/app_flowy/assets/images/grid/field/single_select.svg b/frontend/app_flowy/assets/images/grid/field/single_select.svg new file mode 100644 index 0000000000..8ccbc9a2e3 --- /dev/null +++ b/frontend/app_flowy/assets/images/grid/field/single_select.svg @@ -0,0 +1,4 @@ + + + + diff --git a/frontend/app_flowy/assets/images/grid/field/text.svg b/frontend/app_flowy/assets/images/grid/field/text.svg new file mode 100644 index 0000000000..7befa5080f --- /dev/null +++ b/frontend/app_flowy/assets/images/grid/field/text.svg @@ -0,0 +1,4 @@ + + + + diff --git a/frontend/app_flowy/assets/images/grid/more.svg b/frontend/app_flowy/assets/images/grid/more.svg new file mode 100644 index 0000000000..b191e64a10 --- /dev/null +++ b/frontend/app_flowy/assets/images/grid/more.svg @@ -0,0 +1,3 @@ + + + diff --git a/frontend/app_flowy/assets/translations/en.json b/frontend/app_flowy/assets/translations/en.json index 27574db94e..5646cdff58 100644 --- a/frontend/app_flowy/assets/translations/en.json +++ b/frontend/app_flowy/assets/translations/en.json @@ -148,7 +148,13 @@ "insertLeft": "Insert Left", "insertRight": "Insert Right", "duplicate": "Duplicate", - "delete": "Delete" + "delete": "Delete", + "textFieldName": "Text", + "checkboxFieldName": "Number", + "dateFieldName": "Date", + "numberFieldName": "Number", + "singleSelectFieldName": "Select", + "multiSelectFieldName": "Multiselect" } } } diff --git a/frontend/app_flowy/lib/startup/home_deps_resolver.dart b/frontend/app_flowy/lib/startup/home_deps_resolver.dart index 5c4fc6267f..1702544a64 100644 --- a/frontend/app_flowy/lib/startup/home_deps_resolver.dart +++ b/frontend/app_flowy/lib/startup/home_deps_resolver.dart @@ -103,15 +103,21 @@ class HomeDepsResolver { getIt.registerFactoryParam>( (gridId, fields) => GridHeaderBloc( - data: GridColumnData(fields: fields), - service: FieldService(), + data: GridHeaderData(gridId: gridId, fields: fields), + service: FieldService(gridId: gridId), ), ); - getIt.registerFactoryParam( - (field, _) => FieldEditBloc( - field: field, - service: FieldService(), + getIt.registerFactoryParam( + (data, _) => EditFieldBloc( + field: data.field, + service: FieldService(gridId: data.gridId), + ), + ); + + getIt.registerFactoryParam( + (gridId, _) => CreateFieldBloc( + service: FieldService(gridId: gridId), ), ); diff --git a/frontend/app_flowy/lib/workspace/application/grid/data.dart b/frontend/app_flowy/lib/workspace/application/grid/data.dart index ff1b1e3efc..7c508a6867 100644 --- a/frontend/app_flowy/lib/workspace/application/grid/data.dart +++ b/frontend/app_flowy/lib/workspace/application/grid/data.dart @@ -1,7 +1,8 @@ import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart'; -class GridColumnData { +class GridHeaderData { + final String gridId; final List fields; - GridColumnData({required this.fields}); + GridHeaderData({required this.gridId, required this.fields}); } diff --git a/frontend/app_flowy/lib/workspace/application/grid/field/create_field_bloc.dart b/frontend/app_flowy/lib/workspace/application/grid/field/create_field_bloc.dart new file mode 100644 index 0000000000..0d9126cd1e --- /dev/null +++ b/frontend/app_flowy/lib/workspace/application/grid/field/create_field_bloc.dart @@ -0,0 +1,47 @@ +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'dart:async'; +import 'field_service.dart'; +import 'package:dartz/dartz.dart'; + +part 'create_field_bloc.freezed.dart'; + +class CreateFieldBloc extends Bloc { + final FieldService service; + + CreateFieldBloc({required this.service}) : super(CreateFieldState.initial()) { + on( + (event, emit) async { + await event.map( + initial: (_InitialField value) {}, + updateName: (_UpdateName value) {}, + ); + }, + ); + } + + @override + Future close() async { + return super.close(); + } +} + +@freezed +class CreateFieldEvent with _$CreateFieldEvent { + const factory CreateFieldEvent.initial() = _InitialField; + const factory CreateFieldEvent.updateName(String newName) = _UpdateName; +} + +@freezed +class CreateFieldState with _$CreateFieldState { + const factory CreateFieldState({ + required String errorText, + required Option field, + }) = _CreateFieldState; + + factory CreateFieldState.initial() => CreateFieldState( + field: none(), + errorText: '', + ); +} diff --git a/frontend/app_flowy/lib/workspace/application/grid/field/edit_field_bloc.dart b/frontend/app_flowy/lib/workspace/application/grid/field/edit_field_bloc.dart new file mode 100644 index 0000000000..0944bdd1bb --- /dev/null +++ b/frontend/app_flowy/lib/workspace/application/grid/field/edit_field_bloc.dart @@ -0,0 +1,54 @@ +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'dart:async'; +import 'field_service.dart'; + +part 'edit_field_bloc.freezed.dart'; + +class EditFieldBloc extends Bloc { + final FieldService service; + + EditFieldBloc({required Field field, required this.service}) : super(EditFieldState.initial(field)) { + on( + (event, emit) async { + await event.map( + initial: (_InitialField value) {}, + updateFieldName: (_UpdateFieldName value) { + // + }, + hideField: (_HideField value) {}, + deleteField: (_DeleteField value) {}, + duplicateField: (_DuplicateField value) {}, + ); + }, + ); + } + + @override + Future close() async { + return super.close(); + } +} + +@freezed +class EditFieldEvent with _$EditFieldEvent { + const factory EditFieldEvent.initial() = _InitialField; + const factory EditFieldEvent.updateFieldName(String name) = _UpdateFieldName; + const factory EditFieldEvent.hideField() = _HideField; + const factory EditFieldEvent.duplicateField() = _DuplicateField; + const factory EditFieldEvent.deleteField() = _DeleteField; +} + +@freezed +class EditFieldState with _$EditFieldState { + const factory EditFieldState({ + required Field field, + required String errorText, + }) = _EditFieldState; + + factory EditFieldState.initial(Field field) => EditFieldState( + field: field, + errorText: '', + ); +} diff --git a/frontend/app_flowy/lib/workspace/application/grid/field/field_edit_bloc.dart b/frontend/app_flowy/lib/workspace/application/grid/field/field_edit_bloc.dart deleted file mode 100644 index 2d4aea16da..0000000000 --- a/frontend/app_flowy/lib/workspace/application/grid/field/field_edit_bloc.dart +++ /dev/null @@ -1,58 +0,0 @@ -import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'dart:async'; -import 'field_service.dart'; - -part 'field_edit_bloc.freezed.dart'; - -class FieldEditBloc extends Bloc { - final FieldService service; - - FieldEditBloc({required Field field, required this.service}) : super(FieldEditState.initial(field)) { - on( - (event, emit) async { - await event.map( - initial: (_InitialField value) {}, - createField: (_CreateField value) {}, - updateFieldName: (_UpdateFieldName value) { - // - }, - hideField: (_HideField value) {}, - deleteField: (_DeleteField value) {}, - insertField: (_InsertField value) {}, - duplicateField: (_DuplicateField value) {}, - ); - }, - ); - } - - @override - Future close() async { - return super.close(); - } -} - -@freezed -class FieldEditEvent with _$FieldEditEvent { - const factory FieldEditEvent.initial() = _InitialField; - const factory FieldEditEvent.createField() = _CreateField; - const factory FieldEditEvent.updateFieldName(String name) = _UpdateFieldName; - const factory FieldEditEvent.hideField() = _HideField; - const factory FieldEditEvent.duplicateField() = _DuplicateField; - const factory FieldEditEvent.insertField({required bool onLeft}) = _InsertField; - const factory FieldEditEvent.deleteField() = _DeleteField; -} - -@freezed -class FieldEditState with _$FieldEditState { - const factory FieldEditState({ - required Field field, - required String errorText, - }) = _FieldEditState; - - factory FieldEditState.initial(Field field) => FieldEditState( - field: field, - errorText: '', - ); -} diff --git a/frontend/app_flowy/lib/workspace/application/grid/field/field_service.dart b/frontend/app_flowy/lib/workspace/application/grid/field/field_service.dart index 48d4aa21bd..5a8032b79a 100644 --- a/frontend/app_flowy/lib/workspace/application/grid/field/field_service.dart +++ b/frontend/app_flowy/lib/workspace/application/grid/field/field_service.dart @@ -1 +1,99 @@ -class FieldService {} +import 'dart:typed_data'; + +import 'package:dartz/dartz.dart'; +import 'package:equatable/equatable.dart'; +import 'package:flowy_sdk/dispatch/dispatch.dart'; +import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart'; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart'; +import 'package:flowy_sdk/protobuf/flowy-grid/protobuf.dart'; + +class FieldService { + final String gridId; + + FieldService({required this.gridId}); + + Future> getDefaultField( + String gridId, + ) { + final payload = GridId.create()..value = gridId; + return GridEventCreateDefaultField(payload).send(); + } + + Future> createTextField( + String gridId, + Field field, + RichTextTypeOption typeOption, + String? startFieldId, + ) { + final typeOptionData = typeOption.writeToBuffer(); + return _createField(gridId, field, typeOptionData, startFieldId); + } + + Future> createSingleSelectField( + String gridId, + Field field, + SingleSelectTypeOption typeOption, + String? startFieldId, + ) { + final typeOptionData = typeOption.writeToBuffer(); + return _createField(gridId, field, typeOptionData, startFieldId); + } + + Future> createMultiSelectField( + String gridId, + Field field, + MultiSelectTypeOption typeOption, + String? startFieldId, + ) { + final typeOptionData = typeOption.writeToBuffer(); + return _createField(gridId, field, typeOptionData, startFieldId); + } + + Future> createNumberField( + String gridId, + Field field, + NumberTypeOption typeOption, + String? startFieldId, + ) { + final typeOptionData = typeOption.writeToBuffer(); + return _createField(gridId, field, typeOptionData, startFieldId); + } + + Future> createDateField( + String gridId, + Field field, + DateTypeOption typeOption, + String? startFieldId, + ) { + final typeOptionData = typeOption.writeToBuffer(); + return _createField(gridId, field, typeOptionData, startFieldId); + } + + Future> _createField( + String gridId, + Field field, + Uint8List typeOptionData, + String? startFieldId, + ) { + final payload = CreateFieldPayload.create() + ..gridId = gridId + ..field_2 = field + ..typeOptionData = typeOptionData + ..startFieldId = startFieldId ?? ""; + + return GridEventCreateField(payload).send(); + } +} + +class GridFieldData extends Equatable { + final String gridId; + final Field field; + + const GridFieldData({ + required this.gridId, + required this.field, + }); + + @override + List get props => [field.id]; +} diff --git a/frontend/app_flowy/lib/workspace/application/grid/field/grid_header_bloc.dart b/frontend/app_flowy/lib/workspace/application/grid/field/grid_header_bloc.dart index f4c7459337..a5f3a8414a 100644 --- a/frontend/app_flowy/lib/workspace/application/grid/field/grid_header_bloc.dart +++ b/frontend/app_flowy/lib/workspace/application/grid/field/grid_header_bloc.dart @@ -11,7 +11,7 @@ class GridHeaderBloc extends Bloc { final FieldService service; GridHeaderBloc({ - required GridColumnData data, + required GridHeaderData data, required this.service, }) : super(GridHeaderState.initial(data.fields)) { on( @@ -19,6 +19,7 @@ class GridHeaderBloc extends Bloc { await event.map( initial: (_InitialHeader value) async {}, createField: (_CreateField value) {}, + insertField: (_InsertField value) {}, ); }, ); @@ -34,6 +35,7 @@ class GridHeaderBloc extends Bloc { class GridHeaderEvent with _$GridHeaderEvent { const factory GridHeaderEvent.initial() = _InitialHeader; const factory GridHeaderEvent.createField() = _CreateField; + const factory GridHeaderEvent.insertField({required bool onLeft}) = _InsertField; } @freezed diff --git a/frontend/app_flowy/lib/workspace/application/grid/grid_listenr.dart b/frontend/app_flowy/lib/workspace/application/grid/grid_listenr.dart index e0423d7757..e110491912 100644 --- a/frontend/app_flowy/lib/workspace/application/grid/grid_listenr.dart +++ b/frontend/app_flowy/lib/workspace/application/grid/grid_listenr.dart @@ -31,9 +31,9 @@ class GridListener { void _handleObservableType(GridNotification ty, Either result) { switch (ty) { - case GridNotification.DidUpdateRow: + case GridNotification.DidUpdateFields: result.fold( - (payload) => fieldsUpdateNotifier.value = left(GridBlockId.fromBuffer(payload)), + (payload) => fieldsUpdateNotifier.value = left(RepeatedField.fromBuffer(payload).items), (error) => fieldsUpdateNotifier.value = right(error), ); break; diff --git a/frontend/app_flowy/lib/workspace/application/grid/prelude.dart b/frontend/app_flowy/lib/workspace/application/grid/prelude.dart index 3190ced75d..a1c60d7efb 100644 --- a/frontend/app_flowy/lib/workspace/application/grid/prelude.dart +++ b/frontend/app_flowy/lib/workspace/application/grid/prelude.dart @@ -5,7 +5,8 @@ export 'grid_service.dart'; export 'data.dart'; export 'field/field_service.dart'; export 'field/grid_header_bloc.dart'; -export 'field/field_edit_bloc.dart'; +export 'field/edit_field_bloc.dart'; +export 'field/create_field_bloc.dart'; export 'cell_bloc/text_cell_bloc.dart'; export 'cell_bloc/number_cell_bloc.dart'; export 'cell_bloc/selection_cell_bloc.dart'; diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/create_field_pannel.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/create_field_pannel.dart new file mode 100644 index 0000000000..69d57782a8 --- /dev/null +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/create_field_pannel.dart @@ -0,0 +1,88 @@ +import 'package:app_flowy/startup/startup.dart'; +import 'package:app_flowy/workspace/application/grid/field/create_field_bloc.dart'; +import 'package:flowy_infra_ui/flowy_infra_ui.dart'; +import 'package:flowy_infra_ui/style_widget/text.dart'; +import 'package:flowy_infra_ui/widget/spacing.dart'; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart'; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/meta.pb.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; + +import 'field_name_input.dart'; +import 'field_tyep_switcher.dart'; + +class CreateFieldPannel extends StatelessWidget { + const CreateFieldPannel({Key? key}) : super(key: key); + + static void show(BuildContext context) { + const pannel = CreateFieldPannel(); + FlowyOverlay.of(context).insertWithAnchor( + widget: OverlayContainer( + child: pannel, + constraints: BoxConstraints.loose(const Size(300, 200)), + ), + identifier: pannel.identifier(), + anchorContext: context, + anchorDirection: AnchorDirection.bottomWithLeftAligned, + style: FlowyOverlayStyle(blur: false), + ); + } + + @override + Widget build(BuildContext context) { + return BlocProvider( + create: (context) => getIt()..add(const CreateFieldEvent.initial()), + child: BlocBuilder( + builder: (context, state) { + return state.field.fold( + () => const SizedBox(), + (field) => Column(children: [ + const FlowyText.medium("Edit property"), + const VSpace(10), + _FieldNameTextField(field), + const VSpace(10), + _FieldTypeSwitcher(field), + ]), + ); + }, + ), + ); + } + + String identifier() { + return toString(); + } +} + +class _FieldTypeSwitcher extends StatelessWidget { + final Field field; + const _FieldTypeSwitcher(this.field, {Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return FieldTypeSwitcher( + field: field, + onSelectField: _switchToFieldType, + ); + } + + void _switchToFieldType(FieldType fieldType) { + throw UnimplementedError(); + } +} + +class _FieldNameTextField extends StatelessWidget { + final Field field; + const _FieldNameTextField(this.field, {Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return FieldNameTextField( + name: field.name, + errorText: context.read().state.errorText, + onNameChanged: (newName) { + context.read().add(CreateFieldEvent.updateName(newName)); + }, + ); + } +} diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_editor.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_editor.dart index 531d83a1f3..c199553cc6 100644 --- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_editor.dart +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_editor.dart @@ -1,52 +1,47 @@ import 'package:app_flowy/startup/startup.dart'; import 'package:app_flowy/workspace/application/grid/prelude.dart'; -import 'package:flowy_infra/image.dart'; -import 'package:flowy_infra/theme.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; -import 'package:flowy_infra_ui/style_widget/button.dart'; -import 'package:flowy_infra_ui/style_widget/text.dart'; -import 'package:flowy_infra_ui/widget/rounded_input_field.dart'; import 'package:flowy_infra_ui/widget/spacing.dart'; -import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart' hide Row; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/meta.pb.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:easy_localization/easy_localization.dart'; -import 'package:app_flowy/generated/locale_keys.g.dart'; + +import 'field_name_input.dart'; +import 'field_operation_list.dart'; +import 'field_tyep_switcher.dart'; class FieldEditor extends StatelessWidget { - final Field field; - const FieldEditor({required this.field, Key? key}) : super(key: key); + final GridFieldData fieldData; + const FieldEditor({required this.fieldData, Key? key}) : super(key: key); - static void show(BuildContext context, Field field) { - final editor = FieldEditor(field: field); + static void show(BuildContext context, GridFieldData fieldData) { + final editor = FieldEditor(fieldData: fieldData); FlowyOverlay.of(context).insertWithAnchor( - widget: OverlayContainer(child: editor), + widget: OverlayContainer( + child: editor, + constraints: BoxConstraints.loose(const Size(300, 200)), + ), identifier: editor.identifier(), anchorContext: context, anchorDirection: AnchorDirection.bottomWithLeftAligned, - style: FlowyOverlayStyle(blur: false), ); } @override Widget build(BuildContext context) { - final theme = context.watch(); return BlocProvider( - create: (context) => getIt(param1: field)..add(const FieldEditEvent.initial()), - child: Container( - color: theme.surface, - constraints: BoxConstraints.loose(const Size(300, 200)), - child: SingleChildScrollView( - child: Column(children: [ - const FieldNameTextField(), - // FieldTypeSwitcher(), - const VSpace(10), + create: (context) => getIt(param1: fieldData)..add(const EditFieldEvent.initial()), + child: SingleChildScrollView( + child: Column( + children: [ + const _FieldNameTextField(), + const VSpace(6), + const _FieldTypeSwitcher(), + const VSpace(6), FieldOperationList( - onTap: () { - FlowyOverlay.of(context).remove(identifier()); - }, + onDismiss: () => FlowyOverlay.of(context).remove(identifier()), ), - ]), + ], ), ), ); @@ -57,152 +52,40 @@ class FieldEditor extends StatelessWidget { } } -class FieldNameTextField extends StatelessWidget { - const FieldNameTextField({Key? key}) : super(key: key); +class _FieldTypeSwitcher extends StatelessWidget { + const _FieldTypeSwitcher({Key? key}) : super(key: key); @override Widget build(BuildContext context) { - final theme = context.watch(); - return BlocBuilder( + return BlocBuilder( + builder: (context, state) { + final field = context.read().state.field; + return FieldTypeSwitcher(field: field, onSelectField: _switchToFieldType); + }, + ); + } + + void _switchToFieldType(FieldType fieldType) { + throw UnimplementedError(); + } +} + +class _FieldNameTextField extends StatelessWidget { + const _FieldNameTextField({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return BlocBuilder( buildWhen: ((previous, current) => previous.field.name == current.field.name), builder: (context, state) { - return RoundedInputField( - height: 36, - style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w500), - initialValue: state.field.name, - normalBorderColor: theme.shader4, - errorBorderColor: theme.red, - focusBorderColor: theme.main1, - cursorColor: theme.main1, + return FieldNameTextField( + name: state.field.name, errorText: state.errorText, - onChanged: (value) { - context.read().add(FieldEditEvent.updateFieldName(value)); + onNameChanged: (newName) { + context.read().add(EditFieldEvent.updateFieldName(newName)); }, ); }, ); } } - -class FieldTypeSwitcher extends StatelessWidget { - const FieldTypeSwitcher({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - final theme = context.watch(); - - return FlowyButton( - text: FlowyText.medium(context.read().state.field.name, fontSize: 12), - hoverColor: theme.hover, - onTap: () {}, - leftIcon: svg("editor/details", color: theme.iconColor), - ); - } -} - -class FieldOperationList extends StatelessWidget { - final VoidCallback onTap; - const FieldOperationList({required this.onTap, Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - final children = FieldAction.values - .map((action) => FieldActionItem( - action: action, - onTap: onTap, - )) - .toList(); - return GridView( - // https://api.flutter.dev/flutter/widgets/AnimatedList/shrinkWrap.html - shrinkWrap: true, - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - childAspectRatio: 4.0, - mainAxisSpacing: 8, - ), - children: children, - ); - } -} - -class FieldActionItem extends StatelessWidget { - final VoidCallback onTap; - final FieldAction action; - const FieldActionItem({required this.action, required this.onTap, Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - final theme = context.watch(); - return FlowyButton( - text: FlowyText.medium(action.title(), fontSize: 12), - hoverColor: theme.hover, - onTap: () { - action.run(context); - onTap(); - }, - leftIcon: svg(action.iconName(), color: theme.iconColor), - ); - } -} - -enum FieldAction { - hide, - insertLeft, - duplicate, - insertRight, - delete, -} - -extension _FieldActionExtension on FieldAction { - String iconName() { - switch (this) { - case FieldAction.hide: - return 'grid/hide'; - case FieldAction.insertLeft: - return 'grid/left'; - case FieldAction.insertRight: - return 'grid/right'; - case FieldAction.duplicate: - return 'grid/duplicate'; - case FieldAction.delete: - return 'grid/delete'; - } - } - - String title() { - switch (this) { - case FieldAction.hide: - return LocaleKeys.grid_field_hide.tr(); - case FieldAction.insertLeft: - return LocaleKeys.grid_field_insertLeft.tr(); - case FieldAction.insertRight: - return LocaleKeys.grid_field_insertRight.tr(); - case FieldAction.duplicate: - return LocaleKeys.grid_field_duplicate.tr(); - case FieldAction.delete: - return LocaleKeys.grid_field_delete.tr(); - } - } - - void run(BuildContext context) { - final bloc = context.read(); - - switch (this) { - case FieldAction.hide: - bloc.add(const FieldEditEvent.hideField()); - break; - case FieldAction.insertLeft: - bloc.add(const FieldEditEvent.insertField(onLeft: true)); - break; - case FieldAction.insertRight: - bloc.add(const FieldEditEvent.insertField(onLeft: false)); - break; - case FieldAction.duplicate: - bloc.add(const FieldEditEvent.duplicateField()); - break; - case FieldAction.delete: - bloc.add(const FieldEditEvent.deleteField()); - break; - } - } -} diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_name_input.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_name_input.dart new file mode 100644 index 0000000000..49f0513099 --- /dev/null +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_name_input.dart @@ -0,0 +1,32 @@ +import 'package:flowy_infra/theme.dart'; +import 'package:flowy_infra_ui/widget/rounded_input_field.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; + +class FieldNameTextField extends StatelessWidget { + final void Function(String) onNameChanged; + final String name; + final String errorText; + const FieldNameTextField({ + required this.name, + required this.errorText, + required this.onNameChanged, + Key? key, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + final theme = context.watch(); + return RoundedInputField( + height: 36, + style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w500), + initialValue: name, + normalBorderColor: theme.shader4, + errorBorderColor: theme.red, + focusBorderColor: theme.main1, + cursorColor: theme.main1, + errorText: errorText, + onChanged: onNameChanged, + ); + } +} diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_operation_list.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_operation_list.dart new file mode 100644 index 0000000000..f803bdee58 --- /dev/null +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_operation_list.dart @@ -0,0 +1,100 @@ +import 'package:app_flowy/workspace/application/grid/field/edit_field_bloc.dart'; +import 'package:flowy_infra/image.dart'; +import 'package:flowy_infra/theme.dart'; +import 'package:flowy_infra_ui/style_widget/button.dart'; +import 'package:flowy_infra_ui/style_widget/text.dart'; +import 'package:flutter/material.dart'; +import 'package:easy_localization/easy_localization.dart'; +import 'package:app_flowy/generated/locale_keys.g.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; + +class FieldOperationList extends StatelessWidget { + final VoidCallback onDismiss; + const FieldOperationList({required this.onDismiss, Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + final children = FieldAction.values + .map((action) => FieldActionItem( + action: action, + onTap: onDismiss, + )) + .toList(); + return GridView( + // https://api.flutter.dev/flutter/widgets/AnimatedList/shrinkWrap.html + shrinkWrap: true, + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + childAspectRatio: 4.0, + mainAxisSpacing: 8, + ), + children: children, + ); + } +} + +class FieldActionItem extends StatelessWidget { + final VoidCallback onTap; + final FieldAction action; + const FieldActionItem({required this.action, required this.onTap, Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + final theme = context.watch(); + return FlowyButton( + text: FlowyText.medium(action.title(), fontSize: 12), + hoverColor: theme.hover, + onTap: () { + action.run(context); + onTap(); + }, + leftIcon: svg(action.iconName(), color: theme.iconColor), + ); + } +} + +enum FieldAction { + hide, + // insertLeft, + duplicate, + // insertRight, + delete, +} + +extension _FieldActionExtension on FieldAction { + String iconName() { + switch (this) { + case FieldAction.hide: + return 'grid/hide'; + case FieldAction.duplicate: + return 'grid/duplicate'; + case FieldAction.delete: + return 'grid/delete'; + } + } + + String title() { + switch (this) { + case FieldAction.hide: + return LocaleKeys.grid_field_hide.tr(); + case FieldAction.duplicate: + return LocaleKeys.grid_field_duplicate.tr(); + case FieldAction.delete: + return LocaleKeys.grid_field_delete.tr(); + } + } + + void run(BuildContext context) { + switch (this) { + case FieldAction.hide: + context.read().add(const EditFieldEvent.hideField()); + break; + case FieldAction.duplicate: + context.read().add(const EditFieldEvent.duplicateField()); + break; + case FieldAction.delete: + context.read().add(const EditFieldEvent.deleteField()); + break; + } + } +} diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_tyep_switcher.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_tyep_switcher.dart new file mode 100644 index 0000000000..505715d541 --- /dev/null +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_tyep_switcher.dart @@ -0,0 +1,37 @@ +import 'package:app_flowy/workspace/presentation/plugins/grid/src/widgets/header/field_type_list.dart'; +import 'package:flowy_infra/image.dart'; +import 'package:flowy_infra/theme.dart'; +import 'package:flowy_infra_ui/style_widget/button.dart'; +import 'package:flowy_infra_ui/style_widget/text.dart'; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart'; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/meta.pb.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; + +typedef SelectFieldCallback = void Function(FieldType); + +class FieldTypeSwitcher extends StatelessWidget { + final Field field; + final SelectFieldCallback onSelectField; + const FieldTypeSwitcher({ + required this.field, + required this.onSelectField, + Key? key, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + final theme = context.watch(); + + return SizedBox( + height: 36, + child: FlowyButton( + text: FlowyText.medium(field.name, fontSize: 12), + hoverColor: theme.hover, + onTap: () => FieldTypeList.show(context, onSelectField), + leftIcon: svg(field.fieldType.iconName(), color: theme.iconColor), + rightIcon: svg("grid/more", color: theme.iconColor), + ), + ); + } +} diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_type_list.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_type_list.dart new file mode 100644 index 0000000000..aa5d22804d --- /dev/null +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/field_type_list.dart @@ -0,0 +1,132 @@ +import 'package:app_flowy/workspace/presentation/plugins/grid/src/layout/sizes.dart'; +import 'package:flowy_infra/image.dart'; +import 'package:flowy_infra/theme.dart'; +import 'package:flowy_infra_ui/flowy_infra_ui.dart'; +import 'package:flowy_infra_ui/style_widget/button.dart'; +import 'package:flowy_infra_ui/style_widget/scrolling/styled_list.dart'; +import 'package:flowy_infra_ui/style_widget/text.dart'; +import 'package:flowy_infra_ui/widget/spacing.dart'; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/meta.pb.dart'; +import 'package:flutter/material.dart'; +import 'package:app_flowy/generated/locale_keys.g.dart'; +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; + +typedef SelectFieldCallback = void Function(FieldType); + +class FieldTypeList extends StatelessWidget { + final SelectFieldCallback onSelectField; + const FieldTypeList({required this.onSelectField, Key? key}) : super(key: key); + + static void show(BuildContext context, SelectFieldCallback onSelectField) { + final list = FieldTypeList(onSelectField: onSelectField); + FlowyOverlay.of(context).insertWithAnchor( + widget: OverlayContainer( + child: list, + constraints: BoxConstraints.loose(const Size(140, 300)), + ), + identifier: list.identifier(), + anchorContext: context, + anchorDirection: AnchorDirection.leftWithCenterAligned, + style: FlowyOverlayStyle(blur: false), + anchorOffset: const Offset(-20, 0), + ); + } + + @override + Widget build(BuildContext context) { + final cells = FieldType.values.map((fieldType) { + return FieldTypeCell( + fieldType: fieldType, + onSelectField: (fieldType) { + onSelectField(fieldType); + FlowyOverlay.of(context).remove(identifier()); + }, + ); + }).toList(); + + return ListView.separated( + shrinkWrap: true, + controller: ScrollController(), + itemCount: cells.length, + separatorBuilder: (context, index) { + return const VSpace(10); + }, + physics: StyledScrollPhysics(), + itemBuilder: (BuildContext context, int index) { + return cells[index]; + }, + ); + } + + String identifier() { + return toString(); + } +} + +class FieldTypeCell extends StatelessWidget { + final FieldType fieldType; + final SelectFieldCallback onSelectField; + const FieldTypeCell({ + required this.fieldType, + required this.onSelectField, + Key? key, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + final theme = context.watch(); + + return SizedBox( + height: 26, + child: FlowyButton( + text: FlowyText.medium(fieldType.title(), fontSize: 12), + hoverColor: theme.hover, + onTap: () => onSelectField(fieldType), + leftIcon: svg(fieldType.iconName(), color: theme.iconColor), + ), + ); + } +} + +extension FieldTypeListExtension on FieldType { + String iconName() { + switch (this) { + case FieldType.Checkbox: + return "grid/field/checkbox"; + case FieldType.DateTime: + return "grid/field/date"; + case FieldType.MultiSelect: + return "grid/field/multi_select"; + case FieldType.Number: + return "grid/field/number"; + case FieldType.RichText: + return "grid/field/text"; + case FieldType.SingleSelect: + return "grid/field/single_select"; + default: + assert(false, "Unsupport field type"); + return "grid/field/text"; + } + } + + String title() { + switch (this) { + case FieldType.Checkbox: + return LocaleKeys.grid_field_checkboxFieldName.tr(); + case FieldType.DateTime: + return LocaleKeys.grid_field_dateFieldName.tr(); + case FieldType.MultiSelect: + return LocaleKeys.grid_field_multiSelectFieldName.tr(); + case FieldType.Number: + return LocaleKeys.grid_field_numberFieldName.tr(); + case FieldType.RichText: + return LocaleKeys.grid_field_textFieldName.tr(); + case FieldType.SingleSelect: + return LocaleKeys.grid_field_singleSelectFieldName.tr(); + default: + assert(false, "Unsupport field type"); + return LocaleKeys.grid_field_textFieldName.tr(); + } + } +} diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/header.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/header.dart index f465e43843..1b1cde2acb 100644 --- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/header.dart +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/header.dart @@ -9,6 +9,7 @@ import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart' hide Row; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import 'create_field_pannel.dart'; import 'header_cell.dart'; class GridHeaderDelegate extends SliverPersistentHeaderDelegate { @@ -46,19 +47,30 @@ class GridHeader extends StatelessWidget { Widget build(BuildContext context) { final theme = context.watch(); return BlocProvider( - create: (context) => getIt(param1: gridId, param2: fields)..add(const GridHeaderEvent.initial()), + create: (context) { + final bloc = getIt(param1: gridId, param2: fields); + bloc.add(const GridHeaderEvent.initial()); + return bloc; + }, child: BlocBuilder( - builder: (context, state) => Container( - color: theme.surface, - child: Row( + builder: (context, state) { + final cells = state.fields.map( + (field) => HeaderCell( + GridFieldData(gridId: gridId, field: field), + ), + ); + + final row = Row( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ const _HeaderLeading(), - ...state.fields.map((field) => HeaderCell(field)), + ...cells, const _HeaderTrailing(), ], - ), - ), + ); + + return Container(color: theme.surface, child: row); + }, ), ); } @@ -102,7 +114,7 @@ class CreateFieldButton extends StatelessWidget { return FlowyButton( text: const FlowyText.medium('New column', fontSize: 12), hoverColor: theme.hover, - onTap: () => context.read().add(const GridHeaderEvent.createField()), + onTap: () => CreateFieldPannel.show(context), leftIcon: svg("home/add"), ); } diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/header_cell.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/header_cell.dart index 472c32d8f5..d6e0faff47 100755 --- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/header_cell.dart +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/header/header_cell.dart @@ -1,34 +1,33 @@ +import 'package:app_flowy/workspace/application/grid/field/field_service.dart'; import 'package:app_flowy/workspace/presentation/plugins/grid/src/layout/sizes.dart'; - import 'package:flowy_infra/image.dart'; import 'package:flowy_infra/theme.dart'; import 'package:flowy_infra_ui/style_widget/button.dart'; import 'package:flowy_infra_ui/style_widget/text.dart'; -import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'field_editor.dart'; class HeaderCell extends StatelessWidget { - final Field field; - const HeaderCell(this.field, {Key? key}) : super(key: key); + final GridFieldData fieldData; + const HeaderCell(this.fieldData, {Key? key}) : super(key: key); @override Widget build(BuildContext context) { final theme = context.watch(); final button = FlowyButton( hoverColor: theme.hover, - onTap: () => FieldEditor.show(context, field), + onTap: () => FieldEditor.show(context, fieldData), rightIcon: svg("editor/details", color: theme.iconColor), - text: Padding(padding: GridSize.cellContentInsets, child: FlowyText.medium(field.name, fontSize: 12)), + text: Padding(padding: GridSize.cellContentInsets, child: FlowyText.medium(fieldData.field.name, fontSize: 12)), ); final borderSide = BorderSide(color: theme.shader4, width: 0.4); final decoration = BoxDecoration(border: Border(top: borderSide, right: borderSide, bottom: borderSide)); return Container( - width: field.width.toDouble(), + width: fieldData.field.width.toDouble(), decoration: decoration, padding: GridSize.headerContentInsets, child: button, diff --git a/frontend/app_flowy/packages/flowy_infra_ui/lib/style_widget/button.dart b/frontend/app_flowy/packages/flowy_infra_ui/lib/style_widget/button.dart index dee66a8f11..d74edefba4 100644 --- a/frontend/app_flowy/packages/flowy_infra_ui/lib/style_widget/button.dart +++ b/frontend/app_flowy/packages/flowy_infra_ui/lib/style_widget/button.dart @@ -26,7 +26,7 @@ class FlowyButton extends StatelessWidget { return InkWell( onTap: onTap, child: FlowyHover( - config: HoverDisplayConfig(borderRadius: Corners.s5Border, hoverColor: hoverColor), + config: HoverDisplayConfig(borderRadius: Corners.s6Border, hoverColor: hoverColor), builder: (context, onHover) => _render(), ), ); diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/dispatch/dart_event/flowy-grid/dart_event.dart b/frontend/app_flowy/packages/flowy_sdk/lib/dispatch/dart_event/flowy-grid/dart_event.dart index 80b965177c..c5f7002138 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/dispatch/dart_event/flowy-grid/dart_event.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/dispatch/dart_event/flowy-grid/dart_event.dart @@ -86,6 +86,23 @@ class GridEventCreateField { } } +class GridEventCreateDefaultField { + GridId request; + GridEventCreateDefaultField(this.request); + + Future> send() { + final request = FFIRequest.create() + ..event = GridEvent.CreateDefaultField.toString() + ..payload = requestToBytes(this.request); + + return Dispatch.asyncRequest(request) + .then((bytesResult) => bytesResult.fold( + (okBytes) => left(Field.fromBuffer(okBytes)), + (errBytes) => right(FlowyError.fromBuffer(errBytes)), + )); + } +} + class GridEventCreateRow { CreateRowPayload request; GridEventCreateRow(this.request); diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/cell_data.pb.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/cell_data.pb.dart deleted file mode 100644 index d87c9e02c7..0000000000 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/cell_data.pb.dart +++ /dev/null @@ -1,458 +0,0 @@ -/// -// Generated code. Do not modify. -// source: cell_data.proto -// -// @dart = 2.12 -// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields - -import 'dart:core' as $core; - -import 'package:protobuf/protobuf.dart' as $pb; - -import 'cell_data.pbenum.dart'; - -export 'cell_data.pbenum.dart'; - -class RichTextDescription extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'RichTextDescription', createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'format') - ..hasRequiredFields = false - ; - - RichTextDescription._() : super(); - factory RichTextDescription({ - $core.String? format, - }) { - final _result = create(); - if (format != null) { - _result.format = format; - } - return _result; - } - factory RichTextDescription.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory RichTextDescription.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') - RichTextDescription clone() => RichTextDescription()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - RichTextDescription copyWith(void Function(RichTextDescription) updates) => super.copyWith((message) => updates(message as RichTextDescription)) as RichTextDescription; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static RichTextDescription create() => RichTextDescription._(); - RichTextDescription createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static RichTextDescription getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static RichTextDescription? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get format => $_getSZ(0); - @$pb.TagNumber(1) - set format($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasFormat() => $_has(0); - @$pb.TagNumber(1) - void clearFormat() => clearField(1); -} - -class CheckboxDescription extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'CheckboxDescription', createEmptyInstance: create) - ..aOB(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'isSelected') - ..hasRequiredFields = false - ; - - CheckboxDescription._() : super(); - factory CheckboxDescription({ - $core.bool? isSelected, - }) { - final _result = create(); - if (isSelected != null) { - _result.isSelected = isSelected; - } - return _result; - } - factory CheckboxDescription.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory CheckboxDescription.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') - CheckboxDescription clone() => CheckboxDescription()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - CheckboxDescription copyWith(void Function(CheckboxDescription) updates) => super.copyWith((message) => updates(message as CheckboxDescription)) as CheckboxDescription; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static CheckboxDescription create() => CheckboxDescription._(); - CheckboxDescription createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static CheckboxDescription getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static CheckboxDescription? _defaultInstance; - - @$pb.TagNumber(1) - $core.bool get isSelected => $_getBF(0); - @$pb.TagNumber(1) - set isSelected($core.bool v) { $_setBool(0, v); } - @$pb.TagNumber(1) - $core.bool hasIsSelected() => $_has(0); - @$pb.TagNumber(1) - void clearIsSelected() => clearField(1); -} - -class DateDescription extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'DateDescription', createEmptyInstance: create) - ..e(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'dateFormat', $pb.PbFieldType.OE, defaultOrMaker: DateFormat.Local, valueOf: DateFormat.valueOf, enumValues: DateFormat.values) - ..e(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'timeFormat', $pb.PbFieldType.OE, defaultOrMaker: TimeFormat.TwelveHour, valueOf: TimeFormat.valueOf, enumValues: TimeFormat.values) - ..hasRequiredFields = false - ; - - DateDescription._() : super(); - factory DateDescription({ - DateFormat? dateFormat, - TimeFormat? timeFormat, - }) { - final _result = create(); - if (dateFormat != null) { - _result.dateFormat = dateFormat; - } - if (timeFormat != null) { - _result.timeFormat = timeFormat; - } - return _result; - } - factory DateDescription.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory DateDescription.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') - DateDescription clone() => DateDescription()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - DateDescription copyWith(void Function(DateDescription) updates) => super.copyWith((message) => updates(message as DateDescription)) as DateDescription; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static DateDescription create() => DateDescription._(); - DateDescription createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static DateDescription getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static DateDescription? _defaultInstance; - - @$pb.TagNumber(1) - DateFormat get dateFormat => $_getN(0); - @$pb.TagNumber(1) - set dateFormat(DateFormat v) { setField(1, v); } - @$pb.TagNumber(1) - $core.bool hasDateFormat() => $_has(0); - @$pb.TagNumber(1) - void clearDateFormat() => clearField(1); - - @$pb.TagNumber(2) - TimeFormat get timeFormat => $_getN(1); - @$pb.TagNumber(2) - set timeFormat(TimeFormat v) { setField(2, v); } - @$pb.TagNumber(2) - $core.bool hasTimeFormat() => $_has(1); - @$pb.TagNumber(2) - void clearTimeFormat() => clearField(2); -} - -class SingleSelect extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'SingleSelect', createEmptyInstance: create) - ..pc(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'options', $pb.PbFieldType.PM, subBuilder: SelectOption.create) - ..aOB(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'disableColor') - ..hasRequiredFields = false - ; - - SingleSelect._() : super(); - factory SingleSelect({ - $core.Iterable? options, - $core.bool? disableColor, - }) { - final _result = create(); - if (options != null) { - _result.options.addAll(options); - } - if (disableColor != null) { - _result.disableColor = disableColor; - } - return _result; - } - factory SingleSelect.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory SingleSelect.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') - SingleSelect clone() => SingleSelect()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - SingleSelect copyWith(void Function(SingleSelect) updates) => super.copyWith((message) => updates(message as SingleSelect)) as SingleSelect; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static SingleSelect create() => SingleSelect._(); - SingleSelect createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static SingleSelect getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static SingleSelect? _defaultInstance; - - @$pb.TagNumber(1) - $core.List get options => $_getList(0); - - @$pb.TagNumber(2) - $core.bool get disableColor => $_getBF(1); - @$pb.TagNumber(2) - set disableColor($core.bool v) { $_setBool(1, v); } - @$pb.TagNumber(2) - $core.bool hasDisableColor() => $_has(1); - @$pb.TagNumber(2) - void clearDisableColor() => clearField(2); -} - -class MultiSelect extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'MultiSelect', createEmptyInstance: create) - ..pc(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'options', $pb.PbFieldType.PM, subBuilder: SelectOption.create) - ..aOB(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'disableColor') - ..hasRequiredFields = false - ; - - MultiSelect._() : super(); - factory MultiSelect({ - $core.Iterable? options, - $core.bool? disableColor, - }) { - final _result = create(); - if (options != null) { - _result.options.addAll(options); - } - if (disableColor != null) { - _result.disableColor = disableColor; - } - return _result; - } - factory MultiSelect.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory MultiSelect.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') - MultiSelect clone() => MultiSelect()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - MultiSelect copyWith(void Function(MultiSelect) updates) => super.copyWith((message) => updates(message as MultiSelect)) as MultiSelect; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static MultiSelect create() => MultiSelect._(); - MultiSelect createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static MultiSelect getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static MultiSelect? _defaultInstance; - - @$pb.TagNumber(1) - $core.List get options => $_getList(0); - - @$pb.TagNumber(2) - $core.bool get disableColor => $_getBF(1); - @$pb.TagNumber(2) - set disableColor($core.bool v) { $_setBool(1, v); } - @$pb.TagNumber(2) - $core.bool hasDisableColor() => $_has(1); - @$pb.TagNumber(2) - void clearDisableColor() => clearField(2); -} - -class SelectOption extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'SelectOption', createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'id') - ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name') - ..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'color') - ..hasRequiredFields = false - ; - - SelectOption._() : super(); - factory SelectOption({ - $core.String? id, - $core.String? name, - $core.String? color, - }) { - final _result = create(); - if (id != null) { - _result.id = id; - } - if (name != null) { - _result.name = name; - } - if (color != null) { - _result.color = color; - } - return _result; - } - factory SelectOption.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory SelectOption.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') - SelectOption clone() => SelectOption()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - SelectOption copyWith(void Function(SelectOption) updates) => super.copyWith((message) => updates(message as SelectOption)) as SelectOption; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static SelectOption create() => SelectOption._(); - SelectOption createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static SelectOption getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static SelectOption? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get id => $_getSZ(0); - @$pb.TagNumber(1) - set id($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasId() => $_has(0); - @$pb.TagNumber(1) - void clearId() => clearField(1); - - @$pb.TagNumber(2) - $core.String get name => $_getSZ(1); - @$pb.TagNumber(2) - set name($core.String v) { $_setString(1, v); } - @$pb.TagNumber(2) - $core.bool hasName() => $_has(1); - @$pb.TagNumber(2) - void clearName() => clearField(2); - - @$pb.TagNumber(3) - $core.String get color => $_getSZ(2); - @$pb.TagNumber(3) - set color($core.String v) { $_setString(2, v); } - @$pb.TagNumber(3) - $core.bool hasColor() => $_has(2); - @$pb.TagNumber(3) - void clearColor() => clearField(3); -} - -class NumberDescription extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'NumberDescription', createEmptyInstance: create) - ..e(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'money', $pb.PbFieldType.OE, defaultOrMaker: FlowyMoney.CNY, valueOf: FlowyMoney.valueOf, enumValues: FlowyMoney.values) - ..a<$core.int>(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'scale', $pb.PbFieldType.OU3) - ..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'symbol') - ..aOB(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'signPositive') - ..aOS(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name') - ..hasRequiredFields = false - ; - - NumberDescription._() : super(); - factory NumberDescription({ - FlowyMoney? money, - $core.int? scale, - $core.String? symbol, - $core.bool? signPositive, - $core.String? name, - }) { - final _result = create(); - if (money != null) { - _result.money = money; - } - if (scale != null) { - _result.scale = scale; - } - if (symbol != null) { - _result.symbol = symbol; - } - if (signPositive != null) { - _result.signPositive = signPositive; - } - if (name != null) { - _result.name = name; - } - return _result; - } - factory NumberDescription.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory NumberDescription.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') - NumberDescription clone() => NumberDescription()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - NumberDescription copyWith(void Function(NumberDescription) updates) => super.copyWith((message) => updates(message as NumberDescription)) as NumberDescription; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static NumberDescription create() => NumberDescription._(); - NumberDescription createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static NumberDescription getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static NumberDescription? _defaultInstance; - - @$pb.TagNumber(1) - FlowyMoney get money => $_getN(0); - @$pb.TagNumber(1) - set money(FlowyMoney v) { setField(1, v); } - @$pb.TagNumber(1) - $core.bool hasMoney() => $_has(0); - @$pb.TagNumber(1) - void clearMoney() => clearField(1); - - @$pb.TagNumber(2) - $core.int get scale => $_getIZ(1); - @$pb.TagNumber(2) - set scale($core.int v) { $_setUnsignedInt32(1, v); } - @$pb.TagNumber(2) - $core.bool hasScale() => $_has(1); - @$pb.TagNumber(2) - void clearScale() => clearField(2); - - @$pb.TagNumber(3) - $core.String get symbol => $_getSZ(2); - @$pb.TagNumber(3) - set symbol($core.String v) { $_setString(2, v); } - @$pb.TagNumber(3) - $core.bool hasSymbol() => $_has(2); - @$pb.TagNumber(3) - void clearSymbol() => clearField(3); - - @$pb.TagNumber(4) - $core.bool get signPositive => $_getBF(3); - @$pb.TagNumber(4) - set signPositive($core.bool v) { $_setBool(3, v); } - @$pb.TagNumber(4) - $core.bool hasSignPositive() => $_has(3); - @$pb.TagNumber(4) - void clearSignPositive() => clearField(4); - - @$pb.TagNumber(5) - $core.String get name => $_getSZ(4); - @$pb.TagNumber(5) - set name($core.String v) { $_setString(4, v); } - @$pb.TagNumber(5) - $core.bool hasName() => $_has(4); - @$pb.TagNumber(5) - void clearName() => clearField(5); -} - diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/cell_data.pbenum.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/cell_data.pbenum.dart deleted file mode 100644 index b6512aafba..0000000000 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/cell_data.pbenum.dart +++ /dev/null @@ -1,62 +0,0 @@ -/// -// Generated code. Do not modify. -// source: cell_data.proto -// -// @dart = 2.12 -// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields - -// ignore_for_file: UNDEFINED_SHOWN_NAME -import 'dart:core' as $core; -import 'package:protobuf/protobuf.dart' as $pb; - -class DateFormat extends $pb.ProtobufEnum { - static const DateFormat Local = DateFormat._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Local'); - static const DateFormat US = DateFormat._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'US'); - static const DateFormat ISO = DateFormat._(2, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'ISO'); - static const DateFormat Friendly = DateFormat._(3, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Friendly'); - - static const $core.List values = [ - Local, - US, - ISO, - Friendly, - ]; - - static final $core.Map<$core.int, DateFormat> _byValue = $pb.ProtobufEnum.initByValue(values); - static DateFormat? valueOf($core.int value) => _byValue[value]; - - const DateFormat._($core.int v, $core.String n) : super(v, n); -} - -class TimeFormat extends $pb.ProtobufEnum { - static const TimeFormat TwelveHour = TimeFormat._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'TwelveHour'); - static const TimeFormat TwentyFourHour = TimeFormat._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'TwentyFourHour'); - - static const $core.List values = [ - TwelveHour, - TwentyFourHour, - ]; - - static final $core.Map<$core.int, TimeFormat> _byValue = $pb.ProtobufEnum.initByValue(values); - static TimeFormat? valueOf($core.int value) => _byValue[value]; - - const TimeFormat._($core.int v, $core.String n) : super(v, n); -} - -class FlowyMoney extends $pb.ProtobufEnum { - static const FlowyMoney CNY = FlowyMoney._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'CNY'); - static const FlowyMoney EUR = FlowyMoney._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'EUR'); - static const FlowyMoney USD = FlowyMoney._(2, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'USD'); - - static const $core.List values = [ - CNY, - EUR, - USD, - ]; - - static final $core.Map<$core.int, FlowyMoney> _byValue = $pb.ProtobufEnum.initByValue(values); - static FlowyMoney? valueOf($core.int value) => _byValue[value]; - - const FlowyMoney._($core.int v, $core.String n) : super(v, n); -} - diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/cell_data.pbjson.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/cell_data.pbjson.dart deleted file mode 100644 index c2caf59394..0000000000 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/cell_data.pbjson.dart +++ /dev/null @@ -1,125 +0,0 @@ -/// -// Generated code. Do not modify. -// source: cell_data.proto -// -// @dart = 2.12 -// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package - -import 'dart:core' as $core; -import 'dart:convert' as $convert; -import 'dart:typed_data' as $typed_data; -@$core.Deprecated('Use dateFormatDescriptor instead') -const DateFormat$json = const { - '1': 'DateFormat', - '2': const [ - const {'1': 'Local', '2': 0}, - const {'1': 'US', '2': 1}, - const {'1': 'ISO', '2': 2}, - const {'1': 'Friendly', '2': 3}, - ], -}; - -/// Descriptor for `DateFormat`. Decode as a `google.protobuf.EnumDescriptorProto`. -final $typed_data.Uint8List dateFormatDescriptor = $convert.base64Decode('CgpEYXRlRm9ybWF0EgkKBUxvY2FsEAASBgoCVVMQARIHCgNJU08QAhIMCghGcmllbmRseRAD'); -@$core.Deprecated('Use timeFormatDescriptor instead') -const TimeFormat$json = const { - '1': 'TimeFormat', - '2': const [ - const {'1': 'TwelveHour', '2': 0}, - const {'1': 'TwentyFourHour', '2': 1}, - ], -}; - -/// Descriptor for `TimeFormat`. Decode as a `google.protobuf.EnumDescriptorProto`. -final $typed_data.Uint8List timeFormatDescriptor = $convert.base64Decode('CgpUaW1lRm9ybWF0Eg4KClR3ZWx2ZUhvdXIQABISCg5Ud2VudHlGb3VySG91chAB'); -@$core.Deprecated('Use flowyMoneyDescriptor instead') -const FlowyMoney$json = const { - '1': 'FlowyMoney', - '2': const [ - const {'1': 'CNY', '2': 0}, - const {'1': 'EUR', '2': 1}, - const {'1': 'USD', '2': 2}, - ], -}; - -/// Descriptor for `FlowyMoney`. Decode as a `google.protobuf.EnumDescriptorProto`. -final $typed_data.Uint8List flowyMoneyDescriptor = $convert.base64Decode('CgpGbG93eU1vbmV5EgcKA0NOWRAAEgcKA0VVUhABEgcKA1VTRBAC'); -@$core.Deprecated('Use richTextDescriptionDescriptor instead') -const RichTextDescription$json = const { - '1': 'RichTextDescription', - '2': const [ - const {'1': 'format', '3': 1, '4': 1, '5': 9, '10': 'format'}, - ], -}; - -/// Descriptor for `RichTextDescription`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List richTextDescriptionDescriptor = $convert.base64Decode('ChNSaWNoVGV4dERlc2NyaXB0aW9uEhYKBmZvcm1hdBgBIAEoCVIGZm9ybWF0'); -@$core.Deprecated('Use checkboxDescriptionDescriptor instead') -const CheckboxDescription$json = const { - '1': 'CheckboxDescription', - '2': const [ - const {'1': 'is_selected', '3': 1, '4': 1, '5': 8, '10': 'isSelected'}, - ], -}; - -/// Descriptor for `CheckboxDescription`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List checkboxDescriptionDescriptor = $convert.base64Decode('ChNDaGVja2JveERlc2NyaXB0aW9uEh8KC2lzX3NlbGVjdGVkGAEgASgIUgppc1NlbGVjdGVk'); -@$core.Deprecated('Use dateDescriptionDescriptor instead') -const DateDescription$json = const { - '1': 'DateDescription', - '2': const [ - const {'1': 'date_format', '3': 1, '4': 1, '5': 14, '6': '.DateFormat', '10': 'dateFormat'}, - const {'1': 'time_format', '3': 2, '4': 1, '5': 14, '6': '.TimeFormat', '10': 'timeFormat'}, - ], -}; - -/// Descriptor for `DateDescription`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List dateDescriptionDescriptor = $convert.base64Decode('Cg9EYXRlRGVzY3JpcHRpb24SLAoLZGF0ZV9mb3JtYXQYASABKA4yCy5EYXRlRm9ybWF0UgpkYXRlRm9ybWF0EiwKC3RpbWVfZm9ybWF0GAIgASgOMgsuVGltZUZvcm1hdFIKdGltZUZvcm1hdA=='); -@$core.Deprecated('Use singleSelectDescriptor instead') -const SingleSelect$json = const { - '1': 'SingleSelect', - '2': const [ - const {'1': 'options', '3': 1, '4': 3, '5': 11, '6': '.SelectOption', '10': 'options'}, - const {'1': 'disable_color', '3': 2, '4': 1, '5': 8, '10': 'disableColor'}, - ], -}; - -/// Descriptor for `SingleSelect`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List singleSelectDescriptor = $convert.base64Decode('CgxTaW5nbGVTZWxlY3QSJwoHb3B0aW9ucxgBIAMoCzINLlNlbGVjdE9wdGlvblIHb3B0aW9ucxIjCg1kaXNhYmxlX2NvbG9yGAIgASgIUgxkaXNhYmxlQ29sb3I='); -@$core.Deprecated('Use multiSelectDescriptor instead') -const MultiSelect$json = const { - '1': 'MultiSelect', - '2': const [ - const {'1': 'options', '3': 1, '4': 3, '5': 11, '6': '.SelectOption', '10': 'options'}, - const {'1': 'disable_color', '3': 2, '4': 1, '5': 8, '10': 'disableColor'}, - ], -}; - -/// Descriptor for `MultiSelect`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List multiSelectDescriptor = $convert.base64Decode('CgtNdWx0aVNlbGVjdBInCgdvcHRpb25zGAEgAygLMg0uU2VsZWN0T3B0aW9uUgdvcHRpb25zEiMKDWRpc2FibGVfY29sb3IYAiABKAhSDGRpc2FibGVDb2xvcg=='); -@$core.Deprecated('Use selectOptionDescriptor instead') -const SelectOption$json = const { - '1': 'SelectOption', - '2': const [ - const {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'}, - const {'1': 'name', '3': 2, '4': 1, '5': 9, '10': 'name'}, - const {'1': 'color', '3': 3, '4': 1, '5': 9, '10': 'color'}, - ], -}; - -/// Descriptor for `SelectOption`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List selectOptionDescriptor = $convert.base64Decode('CgxTZWxlY3RPcHRpb24SDgoCaWQYASABKAlSAmlkEhIKBG5hbWUYAiABKAlSBG5hbWUSFAoFY29sb3IYAyABKAlSBWNvbG9y'); -@$core.Deprecated('Use numberDescriptionDescriptor instead') -const NumberDescription$json = const { - '1': 'NumberDescription', - '2': const [ - const {'1': 'money', '3': 1, '4': 1, '5': 14, '6': '.FlowyMoney', '10': 'money'}, - const {'1': 'scale', '3': 2, '4': 1, '5': 13, '10': 'scale'}, - const {'1': 'symbol', '3': 3, '4': 1, '5': 9, '10': 'symbol'}, - const {'1': 'sign_positive', '3': 4, '4': 1, '5': 8, '10': 'signPositive'}, - const {'1': 'name', '3': 5, '4': 1, '5': 9, '10': 'name'}, - ], -}; - -/// Descriptor for `NumberDescription`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List numberDescriptionDescriptor = $convert.base64Decode('ChFOdW1iZXJEZXNjcmlwdGlvbhIhCgVtb25leRgBIAEoDjILLkZsb3d5TW9uZXlSBW1vbmV5EhQKBXNjYWxlGAIgASgNUgVzY2FsZRIWCgZzeW1ib2wYAyABKAlSBnN5bWJvbBIjCg1zaWduX3Bvc2l0aXZlGAQgASgIUgxzaWduUG9zaXRpdmUSEgoEbmFtZRgFIAEoCVIEbmFtZQ=='); diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/checkbox_description.pb.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/checkbox_description.pb.dart deleted file mode 100644 index 04b2ae6e81..0000000000 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/checkbox_description.pb.dart +++ /dev/null @@ -1,58 +0,0 @@ -/// -// Generated code. Do not modify. -// source: checkbox_description.proto -// -// @dart = 2.12 -// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields - -import 'dart:core' as $core; - -import 'package:protobuf/protobuf.dart' as $pb; - -class CheckboxTypeOption extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'CheckboxTypeOption', createEmptyInstance: create) - ..aOB(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'isSelected') - ..hasRequiredFields = false - ; - - CheckboxTypeOption._() : super(); - factory CheckboxTypeOption({ - $core.bool? isSelected, - }) { - final _result = create(); - if (isSelected != null) { - _result.isSelected = isSelected; - } - return _result; - } - factory CheckboxTypeOption.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory CheckboxTypeOption.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') - CheckboxTypeOption clone() => CheckboxTypeOption()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - CheckboxTypeOption copyWith(void Function(CheckboxTypeOption) updates) => super.copyWith((message) => updates(message as CheckboxTypeOption)) as CheckboxTypeOption; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static CheckboxTypeOption create() => CheckboxTypeOption._(); - CheckboxTypeOption createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static CheckboxTypeOption getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static CheckboxTypeOption? _defaultInstance; - - @$pb.TagNumber(1) - $core.bool get isSelected => $_getBF(0); - @$pb.TagNumber(1) - set isSelected($core.bool v) { $_setBool(0, v); } - @$pb.TagNumber(1) - $core.bool hasIsSelected() => $_has(0); - @$pb.TagNumber(1) - void clearIsSelected() => clearField(1); -} - diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/checkbox_description.pbjson.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/checkbox_description.pbjson.dart deleted file mode 100644 index 0569b0665a..0000000000 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/checkbox_description.pbjson.dart +++ /dev/null @@ -1,20 +0,0 @@ -/// -// Generated code. Do not modify. -// source: checkbox_description.proto -// -// @dart = 2.12 -// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package - -import 'dart:core' as $core; -import 'dart:convert' as $convert; -import 'dart:typed_data' as $typed_data; -@$core.Deprecated('Use checkboxTypeOptionDescriptor instead') -const CheckboxTypeOption$json = const { - '1': 'CheckboxTypeOption', - '2': const [ - const {'1': 'is_selected', '3': 1, '4': 1, '5': 8, '10': 'isSelected'}, - ], -}; - -/// Descriptor for `CheckboxTypeOption`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List checkboxTypeOptionDescriptor = $convert.base64Decode('ChJDaGVja2JveFR5cGVPcHRpb24SHwoLaXNfc2VsZWN0ZWQYASABKAhSCmlzU2VsZWN0ZWQ='); diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/checkbox_description.pbserver.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/checkbox_description.pbserver.dart deleted file mode 100644 index 166969b429..0000000000 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/checkbox_description.pbserver.dart +++ /dev/null @@ -1,9 +0,0 @@ -/// -// Generated code. Do not modify. -// source: checkbox_description.proto -// -// @dart = 2.12 -// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package - -export 'checkbox_description.pb.dart'; - diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/date_description.pb.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/date_description.pb.dart deleted file mode 100644 index a70bff6f3c..0000000000 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/date_description.pb.dart +++ /dev/null @@ -1,76 +0,0 @@ -/// -// Generated code. Do not modify. -// source: date_description.proto -// -// @dart = 2.12 -// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields - -import 'dart:core' as $core; - -import 'package:protobuf/protobuf.dart' as $pb; - -import 'date_description.pbenum.dart'; - -export 'date_description.pbenum.dart'; - -class DateDescription extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'DateDescription', createEmptyInstance: create) - ..e(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'dateFormat', $pb.PbFieldType.OE, defaultOrMaker: DateFormat.Local, valueOf: DateFormat.valueOf, enumValues: DateFormat.values) - ..e(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'timeFormat', $pb.PbFieldType.OE, defaultOrMaker: TimeFormat.TwelveHour, valueOf: TimeFormat.valueOf, enumValues: TimeFormat.values) - ..hasRequiredFields = false - ; - - DateDescription._() : super(); - factory DateDescription({ - DateFormat? dateFormat, - TimeFormat? timeFormat, - }) { - final _result = create(); - if (dateFormat != null) { - _result.dateFormat = dateFormat; - } - if (timeFormat != null) { - _result.timeFormat = timeFormat; - } - return _result; - } - factory DateDescription.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory DateDescription.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') - DateDescription clone() => DateDescription()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - DateDescription copyWith(void Function(DateDescription) updates) => super.copyWith((message) => updates(message as DateDescription)) as DateDescription; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static DateDescription create() => DateDescription._(); - DateDescription createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static DateDescription getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static DateDescription? _defaultInstance; - - @$pb.TagNumber(1) - DateFormat get dateFormat => $_getN(0); - @$pb.TagNumber(1) - set dateFormat(DateFormat v) { setField(1, v); } - @$pb.TagNumber(1) - $core.bool hasDateFormat() => $_has(0); - @$pb.TagNumber(1) - void clearDateFormat() => clearField(1); - - @$pb.TagNumber(2) - TimeFormat get timeFormat => $_getN(1); - @$pb.TagNumber(2) - set timeFormat(TimeFormat v) { setField(2, v); } - @$pb.TagNumber(2) - $core.bool hasTimeFormat() => $_has(1); - @$pb.TagNumber(2) - void clearTimeFormat() => clearField(2); -} - diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/date_description.pbenum.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/date_description.pbenum.dart deleted file mode 100644 index 93ea01d9be..0000000000 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/date_description.pbenum.dart +++ /dev/null @@ -1,45 +0,0 @@ -/// -// Generated code. Do not modify. -// source: date_description.proto -// -// @dart = 2.12 -// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields - -// ignore_for_file: UNDEFINED_SHOWN_NAME -import 'dart:core' as $core; -import 'package:protobuf/protobuf.dart' as $pb; - -class DateFormat extends $pb.ProtobufEnum { - static const DateFormat Local = DateFormat._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Local'); - static const DateFormat US = DateFormat._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'US'); - static const DateFormat ISO = DateFormat._(2, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'ISO'); - static const DateFormat Friendly = DateFormat._(3, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Friendly'); - - static const $core.List values = [ - Local, - US, - ISO, - Friendly, - ]; - - static final $core.Map<$core.int, DateFormat> _byValue = $pb.ProtobufEnum.initByValue(values); - static DateFormat? valueOf($core.int value) => _byValue[value]; - - const DateFormat._($core.int v, $core.String n) : super(v, n); -} - -class TimeFormat extends $pb.ProtobufEnum { - static const TimeFormat TwelveHour = TimeFormat._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'TwelveHour'); - static const TimeFormat TwentyFourHour = TimeFormat._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'TwentyFourHour'); - - static const $core.List values = [ - TwelveHour, - TwentyFourHour, - ]; - - static final $core.Map<$core.int, TimeFormat> _byValue = $pb.ProtobufEnum.initByValue(values); - static TimeFormat? valueOf($core.int value) => _byValue[value]; - - const TimeFormat._($core.int v, $core.String n) : super(v, n); -} - diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/date_description.pbjson.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/date_description.pbjson.dart deleted file mode 100644 index 841db39005..0000000000 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/date_description.pbjson.dart +++ /dev/null @@ -1,45 +0,0 @@ -/// -// Generated code. Do not modify. -// source: date_description.proto -// -// @dart = 2.12 -// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package - -import 'dart:core' as $core; -import 'dart:convert' as $convert; -import 'dart:typed_data' as $typed_data; -@$core.Deprecated('Use dateFormatDescriptor instead') -const DateFormat$json = const { - '1': 'DateFormat', - '2': const [ - const {'1': 'Local', '2': 0}, - const {'1': 'US', '2': 1}, - const {'1': 'ISO', '2': 2}, - const {'1': 'Friendly', '2': 3}, - ], -}; - -/// Descriptor for `DateFormat`. Decode as a `google.protobuf.EnumDescriptorProto`. -final $typed_data.Uint8List dateFormatDescriptor = $convert.base64Decode('CgpEYXRlRm9ybWF0EgkKBUxvY2FsEAASBgoCVVMQARIHCgNJU08QAhIMCghGcmllbmRseRAD'); -@$core.Deprecated('Use timeFormatDescriptor instead') -const TimeFormat$json = const { - '1': 'TimeFormat', - '2': const [ - const {'1': 'TwelveHour', '2': 0}, - const {'1': 'TwentyFourHour', '2': 1}, - ], -}; - -/// Descriptor for `TimeFormat`. Decode as a `google.protobuf.EnumDescriptorProto`. -final $typed_data.Uint8List timeFormatDescriptor = $convert.base64Decode('CgpUaW1lRm9ybWF0Eg4KClR3ZWx2ZUhvdXIQABISCg5Ud2VudHlGb3VySG91chAB'); -@$core.Deprecated('Use dateDescriptionDescriptor instead') -const DateDescription$json = const { - '1': 'DateDescription', - '2': const [ - const {'1': 'date_format', '3': 1, '4': 1, '5': 14, '6': '.DateFormat', '10': 'dateFormat'}, - const {'1': 'time_format', '3': 2, '4': 1, '5': 14, '6': '.TimeFormat', '10': 'timeFormat'}, - ], -}; - -/// Descriptor for `DateDescription`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List dateDescriptionDescriptor = $convert.base64Decode('Cg9EYXRlRGVzY3JpcHRpb24SLAoLZGF0ZV9mb3JtYXQYASABKA4yCy5EYXRlRm9ybWF0UgpkYXRlRm9ybWF0EiwKC3RpbWVfZm9ybWF0GAIgASgOMgsuVGltZUZvcm1hdFIKdGltZUZvcm1hdA=='); diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/date_description.pbserver.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/date_description.pbserver.dart deleted file mode 100644 index dd4ff2c3c7..0000000000 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/date_description.pbserver.dart +++ /dev/null @@ -1,9 +0,0 @@ -/// -// Generated code. Do not modify. -// source: date_description.proto -// -// @dart = 2.12 -// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package - -export 'date_description.pb.dart'; - diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/event_map.pbenum.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/event_map.pbenum.dart index 4488ba1a3d..7007f1f6c8 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/event_map.pbenum.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/event_map.pbenum.dart @@ -15,6 +15,7 @@ class GridEvent extends $pb.ProtobufEnum { static const GridEvent GetFields = GridEvent._(10, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'GetFields'); static const GridEvent UpdateField = GridEvent._(11, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'UpdateField'); static const GridEvent CreateField = GridEvent._(12, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'CreateField'); + static const GridEvent CreateDefaultField = GridEvent._(13, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'CreateDefaultField'); static const GridEvent CreateRow = GridEvent._(21, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'CreateRow'); static const GridEvent GetRow = GridEvent._(22, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'GetRow'); static const GridEvent UpdateCell = GridEvent._(30, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'UpdateCell'); @@ -25,6 +26,7 @@ class GridEvent extends $pb.ProtobufEnum { GetFields, UpdateField, CreateField, + CreateDefaultField, CreateRow, GetRow, UpdateCell, diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/event_map.pbjson.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/event_map.pbjson.dart index c70007eaaa..1d94f8227a 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/event_map.pbjson.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/event_map.pbjson.dart @@ -17,6 +17,7 @@ const GridEvent$json = const { const {'1': 'GetFields', '2': 10}, const {'1': 'UpdateField', '2': 11}, const {'1': 'CreateField', '2': 12}, + const {'1': 'CreateDefaultField', '2': 13}, const {'1': 'CreateRow', '2': 21}, const {'1': 'GetRow', '2': 22}, const {'1': 'UpdateCell', '2': 30}, @@ -24,4 +25,4 @@ const GridEvent$json = const { }; /// Descriptor for `GridEvent`. Decode as a `google.protobuf.EnumDescriptorProto`. -final $typed_data.Uint8List gridEventDescriptor = $convert.base64Decode('CglHcmlkRXZlbnQSDwoLR2V0R3JpZERhdGEQABIRCg1HZXRHcmlkQmxvY2tzEAESDQoJR2V0RmllbGRzEAoSDwoLVXBkYXRlRmllbGQQCxIPCgtDcmVhdGVGaWVsZBAMEg0KCUNyZWF0ZVJvdxAVEgoKBkdldFJvdxAWEg4KClVwZGF0ZUNlbGwQHg=='); +final $typed_data.Uint8List gridEventDescriptor = $convert.base64Decode('CglHcmlkRXZlbnQSDwoLR2V0R3JpZERhdGEQABIRCg1HZXRHcmlkQmxvY2tzEAESDQoJR2V0RmllbGRzEAoSDwoLVXBkYXRlRmllbGQQCxIPCgtDcmVhdGVGaWVsZBAMEhYKEkNyZWF0ZURlZmF1bHRGaWVsZBANEg0KCUNyZWF0ZVJvdxAVEgoKBkdldFJvdxAWEg4KClVwZGF0ZUNlbGwQHg=='); diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/number_description.pb.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/number_description.pb.dart deleted file mode 100644 index 19064fbfd1..0000000000 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/number_description.pb.dart +++ /dev/null @@ -1,118 +0,0 @@ -/// -// Generated code. Do not modify. -// source: number_description.proto -// -// @dart = 2.12 -// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields - -import 'dart:core' as $core; - -import 'package:protobuf/protobuf.dart' as $pb; - -import 'number_description.pbenum.dart'; - -export 'number_description.pbenum.dart'; - -class NumberDescription extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'NumberDescription', createEmptyInstance: create) - ..e(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'format', $pb.PbFieldType.OE, defaultOrMaker: NumberFormat.Number, valueOf: NumberFormat.valueOf, enumValues: NumberFormat.values) - ..a<$core.int>(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'scale', $pb.PbFieldType.OU3) - ..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'symbol') - ..aOB(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'signPositive') - ..aOS(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name') - ..hasRequiredFields = false - ; - - NumberDescription._() : super(); - factory NumberDescription({ - NumberFormat? format, - $core.int? scale, - $core.String? symbol, - $core.bool? signPositive, - $core.String? name, - }) { - final _result = create(); - if (format != null) { - _result.format = format; - } - if (scale != null) { - _result.scale = scale; - } - if (symbol != null) { - _result.symbol = symbol; - } - if (signPositive != null) { - _result.signPositive = signPositive; - } - if (name != null) { - _result.name = name; - } - return _result; - } - factory NumberDescription.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory NumberDescription.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') - NumberDescription clone() => NumberDescription()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - NumberDescription copyWith(void Function(NumberDescription) updates) => super.copyWith((message) => updates(message as NumberDescription)) as NumberDescription; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static NumberDescription create() => NumberDescription._(); - NumberDescription createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static NumberDescription getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static NumberDescription? _defaultInstance; - - @$pb.TagNumber(1) - NumberFormat get format => $_getN(0); - @$pb.TagNumber(1) - set format(NumberFormat v) { setField(1, v); } - @$pb.TagNumber(1) - $core.bool hasFormat() => $_has(0); - @$pb.TagNumber(1) - void clearFormat() => clearField(1); - - @$pb.TagNumber(2) - $core.int get scale => $_getIZ(1); - @$pb.TagNumber(2) - set scale($core.int v) { $_setUnsignedInt32(1, v); } - @$pb.TagNumber(2) - $core.bool hasScale() => $_has(1); - @$pb.TagNumber(2) - void clearScale() => clearField(2); - - @$pb.TagNumber(3) - $core.String get symbol => $_getSZ(2); - @$pb.TagNumber(3) - set symbol($core.String v) { $_setString(2, v); } - @$pb.TagNumber(3) - $core.bool hasSymbol() => $_has(2); - @$pb.TagNumber(3) - void clearSymbol() => clearField(3); - - @$pb.TagNumber(4) - $core.bool get signPositive => $_getBF(3); - @$pb.TagNumber(4) - set signPositive($core.bool v) { $_setBool(3, v); } - @$pb.TagNumber(4) - $core.bool hasSignPositive() => $_has(3); - @$pb.TagNumber(4) - void clearSignPositive() => clearField(4); - - @$pb.TagNumber(5) - $core.String get name => $_getSZ(4); - @$pb.TagNumber(5) - set name($core.String v) { $_setString(4, v); } - @$pb.TagNumber(5) - $core.bool hasName() => $_has(4); - @$pb.TagNumber(5) - void clearName() => clearField(5); -} - diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/number_description.pbenum.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/number_description.pbenum.dart deleted file mode 100644 index f5c3d38628..0000000000 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/number_description.pbenum.dart +++ /dev/null @@ -1,30 +0,0 @@ -/// -// Generated code. Do not modify. -// source: number_description.proto -// -// @dart = 2.12 -// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields - -// ignore_for_file: UNDEFINED_SHOWN_NAME -import 'dart:core' as $core; -import 'package:protobuf/protobuf.dart' as $pb; - -class NumberFormat extends $pb.ProtobufEnum { - static const NumberFormat Number = NumberFormat._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Number'); - static const NumberFormat USD = NumberFormat._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'USD'); - static const NumberFormat CNY = NumberFormat._(2, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'CNY'); - static const NumberFormat EUR = NumberFormat._(3, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'EUR'); - - static const $core.List values = [ - Number, - USD, - CNY, - EUR, - ]; - - static final $core.Map<$core.int, NumberFormat> _byValue = $pb.ProtobufEnum.initByValue(values); - static NumberFormat? valueOf($core.int value) => _byValue[value]; - - const NumberFormat._($core.int v, $core.String n) : super(v, n); -} - diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/number_description.pbjson.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/number_description.pbjson.dart deleted file mode 100644 index ff1b3dc40f..0000000000 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/number_description.pbjson.dart +++ /dev/null @@ -1,37 +0,0 @@ -/// -// Generated code. Do not modify. -// source: number_description.proto -// -// @dart = 2.12 -// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package - -import 'dart:core' as $core; -import 'dart:convert' as $convert; -import 'dart:typed_data' as $typed_data; -@$core.Deprecated('Use numberFormatDescriptor instead') -const NumberFormat$json = const { - '1': 'NumberFormat', - '2': const [ - const {'1': 'Number', '2': 0}, - const {'1': 'USD', '2': 1}, - const {'1': 'CNY', '2': 2}, - const {'1': 'EUR', '2': 3}, - ], -}; - -/// Descriptor for `NumberFormat`. Decode as a `google.protobuf.EnumDescriptorProto`. -final $typed_data.Uint8List numberFormatDescriptor = $convert.base64Decode('CgxOdW1iZXJGb3JtYXQSCgoGTnVtYmVyEAASBwoDVVNEEAESBwoDQ05ZEAISBwoDRVVSEAM='); -@$core.Deprecated('Use numberDescriptionDescriptor instead') -const NumberDescription$json = const { - '1': 'NumberDescription', - '2': const [ - const {'1': 'format', '3': 1, '4': 1, '5': 14, '6': '.NumberFormat', '10': 'format'}, - const {'1': 'scale', '3': 2, '4': 1, '5': 13, '10': 'scale'}, - const {'1': 'symbol', '3': 3, '4': 1, '5': 9, '10': 'symbol'}, - const {'1': 'sign_positive', '3': 4, '4': 1, '5': 8, '10': 'signPositive'}, - const {'1': 'name', '3': 5, '4': 1, '5': 9, '10': 'name'}, - ], -}; - -/// Descriptor for `NumberDescription`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List numberDescriptionDescriptor = $convert.base64Decode('ChFOdW1iZXJEZXNjcmlwdGlvbhIlCgZmb3JtYXQYASABKA4yDS5OdW1iZXJGb3JtYXRSBmZvcm1hdBIUCgVzY2FsZRgCIAEoDVIFc2NhbGUSFgoGc3ltYm9sGAMgASgJUgZzeW1ib2wSIwoNc2lnbl9wb3NpdGl2ZRgEIAEoCFIMc2lnblBvc2l0aXZlEhIKBG5hbWUYBSABKAlSBG5hbWU='); diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/number_description.pbserver.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/number_description.pbserver.dart deleted file mode 100644 index 58225a92b7..0000000000 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/number_description.pbserver.dart +++ /dev/null @@ -1,9 +0,0 @@ -/// -// Generated code. Do not modify. -// source: number_description.proto -// -// @dart = 2.12 -// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package - -export 'number_description.pb.dart'; - diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/protobuf.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/protobuf.dart index 8f0a7e7d48..874107f9be 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/protobuf.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/protobuf.dart @@ -1,8 +1,8 @@ // Auto-generated, do not edit export './number_type_option.pb.dart'; -export './text_description.pb.dart'; export './dart_notification.pb.dart'; export './selection_type_option.pb.dart'; export './checkbox_type_option.pb.dart'; export './event_map.pb.dart'; +export './text_type_option.pb.dart'; export './date_type_option.pb.dart'; diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/selection_description.pb.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/selection_description.pb.dart deleted file mode 100644 index 27b2fa8431..0000000000 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/selection_description.pb.dart +++ /dev/null @@ -1,196 +0,0 @@ -/// -// Generated code. Do not modify. -// source: selection_description.proto -// -// @dart = 2.12 -// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields - -import 'dart:core' as $core; - -import 'package:protobuf/protobuf.dart' as $pb; - -class SingleSelectDescription extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'SingleSelectDescription', createEmptyInstance: create) - ..pc(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'options', $pb.PbFieldType.PM, subBuilder: SelectOption.create) - ..aOB(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'disableColor') - ..hasRequiredFields = false - ; - - SingleSelectDescription._() : super(); - factory SingleSelectDescription({ - $core.Iterable? options, - $core.bool? disableColor, - }) { - final _result = create(); - if (options != null) { - _result.options.addAll(options); - } - if (disableColor != null) { - _result.disableColor = disableColor; - } - return _result; - } - factory SingleSelectDescription.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory SingleSelectDescription.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') - SingleSelectDescription clone() => SingleSelectDescription()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - SingleSelectDescription copyWith(void Function(SingleSelectDescription) updates) => super.copyWith((message) => updates(message as SingleSelectDescription)) as SingleSelectDescription; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static SingleSelectDescription create() => SingleSelectDescription._(); - SingleSelectDescription createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static SingleSelectDescription getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static SingleSelectDescription? _defaultInstance; - - @$pb.TagNumber(1) - $core.List get options => $_getList(0); - - @$pb.TagNumber(2) - $core.bool get disableColor => $_getBF(1); - @$pb.TagNumber(2) - set disableColor($core.bool v) { $_setBool(1, v); } - @$pb.TagNumber(2) - $core.bool hasDisableColor() => $_has(1); - @$pb.TagNumber(2) - void clearDisableColor() => clearField(2); -} - -class MultiSelectDescription extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'MultiSelectDescription', createEmptyInstance: create) - ..pc(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'options', $pb.PbFieldType.PM, subBuilder: SelectOption.create) - ..aOB(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'disableColor') - ..hasRequiredFields = false - ; - - MultiSelectDescription._() : super(); - factory MultiSelectDescription({ - $core.Iterable? options, - $core.bool? disableColor, - }) { - final _result = create(); - if (options != null) { - _result.options.addAll(options); - } - if (disableColor != null) { - _result.disableColor = disableColor; - } - return _result; - } - factory MultiSelectDescription.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory MultiSelectDescription.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') - MultiSelectDescription clone() => MultiSelectDescription()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - MultiSelectDescription copyWith(void Function(MultiSelectDescription) updates) => super.copyWith((message) => updates(message as MultiSelectDescription)) as MultiSelectDescription; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static MultiSelectDescription create() => MultiSelectDescription._(); - MultiSelectDescription createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static MultiSelectDescription getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static MultiSelectDescription? _defaultInstance; - - @$pb.TagNumber(1) - $core.List get options => $_getList(0); - - @$pb.TagNumber(2) - $core.bool get disableColor => $_getBF(1); - @$pb.TagNumber(2) - set disableColor($core.bool v) { $_setBool(1, v); } - @$pb.TagNumber(2) - $core.bool hasDisableColor() => $_has(1); - @$pb.TagNumber(2) - void clearDisableColor() => clearField(2); -} - -class SelectOption extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'SelectOption', createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'id') - ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name') - ..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'color') - ..hasRequiredFields = false - ; - - SelectOption._() : super(); - factory SelectOption({ - $core.String? id, - $core.String? name, - $core.String? color, - }) { - final _result = create(); - if (id != null) { - _result.id = id; - } - if (name != null) { - _result.name = name; - } - if (color != null) { - _result.color = color; - } - return _result; - } - factory SelectOption.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory SelectOption.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') - SelectOption clone() => SelectOption()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - SelectOption copyWith(void Function(SelectOption) updates) => super.copyWith((message) => updates(message as SelectOption)) as SelectOption; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static SelectOption create() => SelectOption._(); - SelectOption createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static SelectOption getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static SelectOption? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get id => $_getSZ(0); - @$pb.TagNumber(1) - set id($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasId() => $_has(0); - @$pb.TagNumber(1) - void clearId() => clearField(1); - - @$pb.TagNumber(2) - $core.String get name => $_getSZ(1); - @$pb.TagNumber(2) - set name($core.String v) { $_setString(1, v); } - @$pb.TagNumber(2) - $core.bool hasName() => $_has(1); - @$pb.TagNumber(2) - void clearName() => clearField(2); - - @$pb.TagNumber(3) - $core.String get color => $_getSZ(2); - @$pb.TagNumber(3) - set color($core.String v) { $_setString(2, v); } - @$pb.TagNumber(3) - $core.bool hasColor() => $_has(2); - @$pb.TagNumber(3) - void clearColor() => clearField(3); -} - diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/selection_description.pbenum.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/selection_description.pbenum.dart deleted file mode 100644 index 6688bc34c9..0000000000 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/selection_description.pbenum.dart +++ /dev/null @@ -1,7 +0,0 @@ -/// -// Generated code. Do not modify. -// source: selection_description.proto -// -// @dart = 2.12 -// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields - diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/selection_description.pbjson.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/selection_description.pbjson.dart deleted file mode 100644 index 6bb0c9e4db..0000000000 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/selection_description.pbjson.dart +++ /dev/null @@ -1,44 +0,0 @@ -/// -// Generated code. Do not modify. -// source: selection_description.proto -// -// @dart = 2.12 -// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package - -import 'dart:core' as $core; -import 'dart:convert' as $convert; -import 'dart:typed_data' as $typed_data; -@$core.Deprecated('Use singleSelectDescriptionDescriptor instead') -const SingleSelectDescription$json = const { - '1': 'SingleSelectDescription', - '2': const [ - const {'1': 'options', '3': 1, '4': 3, '5': 11, '6': '.SelectOption', '10': 'options'}, - const {'1': 'disable_color', '3': 2, '4': 1, '5': 8, '10': 'disableColor'}, - ], -}; - -/// Descriptor for `SingleSelectDescription`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List singleSelectDescriptionDescriptor = $convert.base64Decode('ChdTaW5nbGVTZWxlY3REZXNjcmlwdGlvbhInCgdvcHRpb25zGAEgAygLMg0uU2VsZWN0T3B0aW9uUgdvcHRpb25zEiMKDWRpc2FibGVfY29sb3IYAiABKAhSDGRpc2FibGVDb2xvcg=='); -@$core.Deprecated('Use multiSelectDescriptionDescriptor instead') -const MultiSelectDescription$json = const { - '1': 'MultiSelectDescription', - '2': const [ - const {'1': 'options', '3': 1, '4': 3, '5': 11, '6': '.SelectOption', '10': 'options'}, - const {'1': 'disable_color', '3': 2, '4': 1, '5': 8, '10': 'disableColor'}, - ], -}; - -/// Descriptor for `MultiSelectDescription`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List multiSelectDescriptionDescriptor = $convert.base64Decode('ChZNdWx0aVNlbGVjdERlc2NyaXB0aW9uEicKB29wdGlvbnMYASADKAsyDS5TZWxlY3RPcHRpb25SB29wdGlvbnMSIwoNZGlzYWJsZV9jb2xvchgCIAEoCFIMZGlzYWJsZUNvbG9y'); -@$core.Deprecated('Use selectOptionDescriptor instead') -const SelectOption$json = const { - '1': 'SelectOption', - '2': const [ - const {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'}, - const {'1': 'name', '3': 2, '4': 1, '5': 9, '10': 'name'}, - const {'1': 'color', '3': 3, '4': 1, '5': 9, '10': 'color'}, - ], -}; - -/// Descriptor for `SelectOption`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List selectOptionDescriptor = $convert.base64Decode('CgxTZWxlY3RPcHRpb24SDgoCaWQYASABKAlSAmlkEhIKBG5hbWUYAiABKAlSBG5hbWUSFAoFY29sb3IYAyABKAlSBWNvbG9y'); diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/selection_description.pbserver.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/selection_description.pbserver.dart deleted file mode 100644 index f55cbba1ec..0000000000 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/selection_description.pbserver.dart +++ /dev/null @@ -1,9 +0,0 @@ -/// -// Generated code. Do not modify. -// source: selection_description.proto -// -// @dart = 2.12 -// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package - -export 'selection_description.pb.dart'; - diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/text_type_option.pb.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/text_type_option.pb.dart new file mode 100644 index 0000000000..c30f2eb6e1 --- /dev/null +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/text_type_option.pb.dart @@ -0,0 +1,58 @@ +/// +// Generated code. Do not modify. +// source: text_type_option.proto +// +// @dart = 2.12 +// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; + +class RichTextTypeOption extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'RichTextTypeOption', createEmptyInstance: create) + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'format') + ..hasRequiredFields = false + ; + + RichTextTypeOption._() : super(); + factory RichTextTypeOption({ + $core.String? format, + }) { + final _result = create(); + if (format != null) { + _result.format = format; + } + return _result; + } + factory RichTextTypeOption.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory RichTextTypeOption.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') + RichTextTypeOption clone() => RichTextTypeOption()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + RichTextTypeOption copyWith(void Function(RichTextTypeOption) updates) => super.copyWith((message) => updates(message as RichTextTypeOption)) as RichTextTypeOption; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static RichTextTypeOption create() => RichTextTypeOption._(); + RichTextTypeOption createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static RichTextTypeOption getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static RichTextTypeOption? _defaultInstance; + + @$pb.TagNumber(1) + $core.String get format => $_getSZ(0); + @$pb.TagNumber(1) + set format($core.String v) { $_setString(0, v); } + @$pb.TagNumber(1) + $core.bool hasFormat() => $_has(0); + @$pb.TagNumber(1) + void clearFormat() => clearField(1); +} + diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/checkbox_description.pbenum.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/text_type_option.pbenum.dart similarity index 87% rename from frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/checkbox_description.pbenum.dart rename to frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/text_type_option.pbenum.dart index 0070b08607..f2bd90bfa5 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/checkbox_description.pbenum.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/text_type_option.pbenum.dart @@ -1,6 +1,6 @@ /// // Generated code. Do not modify. -// source: checkbox_description.proto +// source: text_type_option.proto // // @dart = 2.12 // ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/text_type_option.pbjson.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/text_type_option.pbjson.dart new file mode 100644 index 0000000000..e4ba6956ee --- /dev/null +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/text_type_option.pbjson.dart @@ -0,0 +1,20 @@ +/// +// Generated code. Do not modify. +// source: text_type_option.proto +// +// @dart = 2.12 +// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package + +import 'dart:core' as $core; +import 'dart:convert' as $convert; +import 'dart:typed_data' as $typed_data; +@$core.Deprecated('Use richTextTypeOptionDescriptor instead') +const RichTextTypeOption$json = const { + '1': 'RichTextTypeOption', + '2': const [ + const {'1': 'format', '3': 1, '4': 1, '5': 9, '10': 'format'}, + ], +}; + +/// Descriptor for `RichTextTypeOption`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List richTextTypeOptionDescriptor = $convert.base64Decode('ChJSaWNoVGV4dFR5cGVPcHRpb24SFgoGZm9ybWF0GAEgASgJUgZmb3JtYXQ='); diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/cell_data.pbserver.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/text_type_option.pbserver.dart similarity index 81% rename from frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/cell_data.pbserver.dart rename to frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/text_type_option.pbserver.dart index bae86fb5d9..6620aa1ee7 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/cell_data.pbserver.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/text_type_option.pbserver.dart @@ -1,9 +1,9 @@ /// // Generated code. Do not modify. -// source: cell_data.proto +// source: text_type_option.proto // // @dart = 2.12 // ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package -export 'cell_data.pb.dart'; +export 'text_type_option.pb.dart'; diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/type_options.pb.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/type_options.pb.dart deleted file mode 100644 index 152eef0c74..0000000000 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/type_options.pb.dart +++ /dev/null @@ -1,458 +0,0 @@ -/// -// Generated code. Do not modify. -// source: type_options.proto -// -// @dart = 2.12 -// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields - -import 'dart:core' as $core; - -import 'package:protobuf/protobuf.dart' as $pb; - -import 'type_options.pbenum.dart'; - -export 'type_options.pbenum.dart'; - -class RichTextDescription extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'RichTextDescription', createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'format') - ..hasRequiredFields = false - ; - - RichTextDescription._() : super(); - factory RichTextDescription({ - $core.String? format, - }) { - final _result = create(); - if (format != null) { - _result.format = format; - } - return _result; - } - factory RichTextDescription.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory RichTextDescription.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') - RichTextDescription clone() => RichTextDescription()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - RichTextDescription copyWith(void Function(RichTextDescription) updates) => super.copyWith((message) => updates(message as RichTextDescription)) as RichTextDescription; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static RichTextDescription create() => RichTextDescription._(); - RichTextDescription createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static RichTextDescription getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static RichTextDescription? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get format => $_getSZ(0); - @$pb.TagNumber(1) - set format($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasFormat() => $_has(0); - @$pb.TagNumber(1) - void clearFormat() => clearField(1); -} - -class CheckboxDescription extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'CheckboxDescription', createEmptyInstance: create) - ..aOB(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'isSelected') - ..hasRequiredFields = false - ; - - CheckboxDescription._() : super(); - factory CheckboxDescription({ - $core.bool? isSelected, - }) { - final _result = create(); - if (isSelected != null) { - _result.isSelected = isSelected; - } - return _result; - } - factory CheckboxDescription.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory CheckboxDescription.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') - CheckboxDescription clone() => CheckboxDescription()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - CheckboxDescription copyWith(void Function(CheckboxDescription) updates) => super.copyWith((message) => updates(message as CheckboxDescription)) as CheckboxDescription; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static CheckboxDescription create() => CheckboxDescription._(); - CheckboxDescription createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static CheckboxDescription getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static CheckboxDescription? _defaultInstance; - - @$pb.TagNumber(1) - $core.bool get isSelected => $_getBF(0); - @$pb.TagNumber(1) - set isSelected($core.bool v) { $_setBool(0, v); } - @$pb.TagNumber(1) - $core.bool hasIsSelected() => $_has(0); - @$pb.TagNumber(1) - void clearIsSelected() => clearField(1); -} - -class DateDescription extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'DateDescription', createEmptyInstance: create) - ..e(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'dateFormat', $pb.PbFieldType.OE, defaultOrMaker: DateFormat.Local, valueOf: DateFormat.valueOf, enumValues: DateFormat.values) - ..e(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'timeFormat', $pb.PbFieldType.OE, defaultOrMaker: TimeFormat.TwelveHour, valueOf: TimeFormat.valueOf, enumValues: TimeFormat.values) - ..hasRequiredFields = false - ; - - DateDescription._() : super(); - factory DateDescription({ - DateFormat? dateFormat, - TimeFormat? timeFormat, - }) { - final _result = create(); - if (dateFormat != null) { - _result.dateFormat = dateFormat; - } - if (timeFormat != null) { - _result.timeFormat = timeFormat; - } - return _result; - } - factory DateDescription.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory DateDescription.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') - DateDescription clone() => DateDescription()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - DateDescription copyWith(void Function(DateDescription) updates) => super.copyWith((message) => updates(message as DateDescription)) as DateDescription; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static DateDescription create() => DateDescription._(); - DateDescription createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static DateDescription getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static DateDescription? _defaultInstance; - - @$pb.TagNumber(1) - DateFormat get dateFormat => $_getN(0); - @$pb.TagNumber(1) - set dateFormat(DateFormat v) { setField(1, v); } - @$pb.TagNumber(1) - $core.bool hasDateFormat() => $_has(0); - @$pb.TagNumber(1) - void clearDateFormat() => clearField(1); - - @$pb.TagNumber(2) - TimeFormat get timeFormat => $_getN(1); - @$pb.TagNumber(2) - set timeFormat(TimeFormat v) { setField(2, v); } - @$pb.TagNumber(2) - $core.bool hasTimeFormat() => $_has(1); - @$pb.TagNumber(2) - void clearTimeFormat() => clearField(2); -} - -class SingleSelectDescription extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'SingleSelectDescription', createEmptyInstance: create) - ..pc(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'options', $pb.PbFieldType.PM, subBuilder: SelectOption.create) - ..aOB(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'disableColor') - ..hasRequiredFields = false - ; - - SingleSelectDescription._() : super(); - factory SingleSelectDescription({ - $core.Iterable? options, - $core.bool? disableColor, - }) { - final _result = create(); - if (options != null) { - _result.options.addAll(options); - } - if (disableColor != null) { - _result.disableColor = disableColor; - } - return _result; - } - factory SingleSelectDescription.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory SingleSelectDescription.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') - SingleSelectDescription clone() => SingleSelectDescription()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - SingleSelectDescription copyWith(void Function(SingleSelectDescription) updates) => super.copyWith((message) => updates(message as SingleSelectDescription)) as SingleSelectDescription; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static SingleSelectDescription create() => SingleSelectDescription._(); - SingleSelectDescription createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static SingleSelectDescription getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static SingleSelectDescription? _defaultInstance; - - @$pb.TagNumber(1) - $core.List get options => $_getList(0); - - @$pb.TagNumber(2) - $core.bool get disableColor => $_getBF(1); - @$pb.TagNumber(2) - set disableColor($core.bool v) { $_setBool(1, v); } - @$pb.TagNumber(2) - $core.bool hasDisableColor() => $_has(1); - @$pb.TagNumber(2) - void clearDisableColor() => clearField(2); -} - -class MultiSelectDescription extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'MultiSelectDescription', createEmptyInstance: create) - ..pc(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'options', $pb.PbFieldType.PM, subBuilder: SelectOption.create) - ..aOB(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'disableColor') - ..hasRequiredFields = false - ; - - MultiSelectDescription._() : super(); - factory MultiSelectDescription({ - $core.Iterable? options, - $core.bool? disableColor, - }) { - final _result = create(); - if (options != null) { - _result.options.addAll(options); - } - if (disableColor != null) { - _result.disableColor = disableColor; - } - return _result; - } - factory MultiSelectDescription.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory MultiSelectDescription.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') - MultiSelectDescription clone() => MultiSelectDescription()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - MultiSelectDescription copyWith(void Function(MultiSelectDescription) updates) => super.copyWith((message) => updates(message as MultiSelectDescription)) as MultiSelectDescription; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static MultiSelectDescription create() => MultiSelectDescription._(); - MultiSelectDescription createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static MultiSelectDescription getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static MultiSelectDescription? _defaultInstance; - - @$pb.TagNumber(1) - $core.List get options => $_getList(0); - - @$pb.TagNumber(2) - $core.bool get disableColor => $_getBF(1); - @$pb.TagNumber(2) - set disableColor($core.bool v) { $_setBool(1, v); } - @$pb.TagNumber(2) - $core.bool hasDisableColor() => $_has(1); - @$pb.TagNumber(2) - void clearDisableColor() => clearField(2); -} - -class SelectOption extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'SelectOption', createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'id') - ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name') - ..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'color') - ..hasRequiredFields = false - ; - - SelectOption._() : super(); - factory SelectOption({ - $core.String? id, - $core.String? name, - $core.String? color, - }) { - final _result = create(); - if (id != null) { - _result.id = id; - } - if (name != null) { - _result.name = name; - } - if (color != null) { - _result.color = color; - } - return _result; - } - factory SelectOption.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory SelectOption.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') - SelectOption clone() => SelectOption()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - SelectOption copyWith(void Function(SelectOption) updates) => super.copyWith((message) => updates(message as SelectOption)) as SelectOption; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static SelectOption create() => SelectOption._(); - SelectOption createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static SelectOption getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static SelectOption? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get id => $_getSZ(0); - @$pb.TagNumber(1) - set id($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasId() => $_has(0); - @$pb.TagNumber(1) - void clearId() => clearField(1); - - @$pb.TagNumber(2) - $core.String get name => $_getSZ(1); - @$pb.TagNumber(2) - set name($core.String v) { $_setString(1, v); } - @$pb.TagNumber(2) - $core.bool hasName() => $_has(1); - @$pb.TagNumber(2) - void clearName() => clearField(2); - - @$pb.TagNumber(3) - $core.String get color => $_getSZ(2); - @$pb.TagNumber(3) - set color($core.String v) { $_setString(2, v); } - @$pb.TagNumber(3) - $core.bool hasColor() => $_has(2); - @$pb.TagNumber(3) - void clearColor() => clearField(3); -} - -class NumberDescription extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'NumberDescription', createEmptyInstance: create) - ..e(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'money', $pb.PbFieldType.OE, defaultOrMaker: MoneySymbol.CNY, valueOf: MoneySymbol.valueOf, enumValues: MoneySymbol.values) - ..a<$core.int>(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'scale', $pb.PbFieldType.OU3) - ..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'symbol') - ..aOB(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'signPositive') - ..aOS(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name') - ..hasRequiredFields = false - ; - - NumberDescription._() : super(); - factory NumberDescription({ - MoneySymbol? money, - $core.int? scale, - $core.String? symbol, - $core.bool? signPositive, - $core.String? name, - }) { - final _result = create(); - if (money != null) { - _result.money = money; - } - if (scale != null) { - _result.scale = scale; - } - if (symbol != null) { - _result.symbol = symbol; - } - if (signPositive != null) { - _result.signPositive = signPositive; - } - if (name != null) { - _result.name = name; - } - return _result; - } - factory NumberDescription.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory NumberDescription.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') - NumberDescription clone() => NumberDescription()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - NumberDescription copyWith(void Function(NumberDescription) updates) => super.copyWith((message) => updates(message as NumberDescription)) as NumberDescription; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static NumberDescription create() => NumberDescription._(); - NumberDescription createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static NumberDescription getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static NumberDescription? _defaultInstance; - - @$pb.TagNumber(1) - MoneySymbol get money => $_getN(0); - @$pb.TagNumber(1) - set money(MoneySymbol v) { setField(1, v); } - @$pb.TagNumber(1) - $core.bool hasMoney() => $_has(0); - @$pb.TagNumber(1) - void clearMoney() => clearField(1); - - @$pb.TagNumber(2) - $core.int get scale => $_getIZ(1); - @$pb.TagNumber(2) - set scale($core.int v) { $_setUnsignedInt32(1, v); } - @$pb.TagNumber(2) - $core.bool hasScale() => $_has(1); - @$pb.TagNumber(2) - void clearScale() => clearField(2); - - @$pb.TagNumber(3) - $core.String get symbol => $_getSZ(2); - @$pb.TagNumber(3) - set symbol($core.String v) { $_setString(2, v); } - @$pb.TagNumber(3) - $core.bool hasSymbol() => $_has(2); - @$pb.TagNumber(3) - void clearSymbol() => clearField(3); - - @$pb.TagNumber(4) - $core.bool get signPositive => $_getBF(3); - @$pb.TagNumber(4) - set signPositive($core.bool v) { $_setBool(3, v); } - @$pb.TagNumber(4) - $core.bool hasSignPositive() => $_has(3); - @$pb.TagNumber(4) - void clearSignPositive() => clearField(4); - - @$pb.TagNumber(5) - $core.String get name => $_getSZ(4); - @$pb.TagNumber(5) - set name($core.String v) { $_setString(4, v); } - @$pb.TagNumber(5) - $core.bool hasName() => $_has(4); - @$pb.TagNumber(5) - void clearName() => clearField(5); -} - diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/type_options.pbenum.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/type_options.pbenum.dart deleted file mode 100644 index c3815cf5e1..0000000000 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/type_options.pbenum.dart +++ /dev/null @@ -1,62 +0,0 @@ -/// -// Generated code. Do not modify. -// source: type_options.proto -// -// @dart = 2.12 -// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields - -// ignore_for_file: UNDEFINED_SHOWN_NAME -import 'dart:core' as $core; -import 'package:protobuf/protobuf.dart' as $pb; - -class DateFormat extends $pb.ProtobufEnum { - static const DateFormat Local = DateFormat._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Local'); - static const DateFormat US = DateFormat._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'US'); - static const DateFormat ISO = DateFormat._(2, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'ISO'); - static const DateFormat Friendly = DateFormat._(3, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Friendly'); - - static const $core.List values = [ - Local, - US, - ISO, - Friendly, - ]; - - static final $core.Map<$core.int, DateFormat> _byValue = $pb.ProtobufEnum.initByValue(values); - static DateFormat? valueOf($core.int value) => _byValue[value]; - - const DateFormat._($core.int v, $core.String n) : super(v, n); -} - -class TimeFormat extends $pb.ProtobufEnum { - static const TimeFormat TwelveHour = TimeFormat._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'TwelveHour'); - static const TimeFormat TwentyFourHour = TimeFormat._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'TwentyFourHour'); - - static const $core.List values = [ - TwelveHour, - TwentyFourHour, - ]; - - static final $core.Map<$core.int, TimeFormat> _byValue = $pb.ProtobufEnum.initByValue(values); - static TimeFormat? valueOf($core.int value) => _byValue[value]; - - const TimeFormat._($core.int v, $core.String n) : super(v, n); -} - -class MoneySymbol extends $pb.ProtobufEnum { - static const MoneySymbol CNY = MoneySymbol._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'CNY'); - static const MoneySymbol EUR = MoneySymbol._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'EUR'); - static const MoneySymbol USD = MoneySymbol._(2, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'USD'); - - static const $core.List values = [ - CNY, - EUR, - USD, - ]; - - static final $core.Map<$core.int, MoneySymbol> _byValue = $pb.ProtobufEnum.initByValue(values); - static MoneySymbol? valueOf($core.int value) => _byValue[value]; - - const MoneySymbol._($core.int v, $core.String n) : super(v, n); -} - diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/type_options.pbjson.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/type_options.pbjson.dart deleted file mode 100644 index 71e0cf884b..0000000000 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/type_options.pbjson.dart +++ /dev/null @@ -1,125 +0,0 @@ -/// -// Generated code. Do not modify. -// source: type_options.proto -// -// @dart = 2.12 -// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package - -import 'dart:core' as $core; -import 'dart:convert' as $convert; -import 'dart:typed_data' as $typed_data; -@$core.Deprecated('Use dateFormatDescriptor instead') -const DateFormat$json = const { - '1': 'DateFormat', - '2': const [ - const {'1': 'Local', '2': 0}, - const {'1': 'US', '2': 1}, - const {'1': 'ISO', '2': 2}, - const {'1': 'Friendly', '2': 3}, - ], -}; - -/// Descriptor for `DateFormat`. Decode as a `google.protobuf.EnumDescriptorProto`. -final $typed_data.Uint8List dateFormatDescriptor = $convert.base64Decode('CgpEYXRlRm9ybWF0EgkKBUxvY2FsEAASBgoCVVMQARIHCgNJU08QAhIMCghGcmllbmRseRAD'); -@$core.Deprecated('Use timeFormatDescriptor instead') -const TimeFormat$json = const { - '1': 'TimeFormat', - '2': const [ - const {'1': 'TwelveHour', '2': 0}, - const {'1': 'TwentyFourHour', '2': 1}, - ], -}; - -/// Descriptor for `TimeFormat`. Decode as a `google.protobuf.EnumDescriptorProto`. -final $typed_data.Uint8List timeFormatDescriptor = $convert.base64Decode('CgpUaW1lRm9ybWF0Eg4KClR3ZWx2ZUhvdXIQABISCg5Ud2VudHlGb3VySG91chAB'); -@$core.Deprecated('Use moneySymbolDescriptor instead') -const MoneySymbol$json = const { - '1': 'MoneySymbol', - '2': const [ - const {'1': 'CNY', '2': 0}, - const {'1': 'EUR', '2': 1}, - const {'1': 'USD', '2': 2}, - ], -}; - -/// Descriptor for `MoneySymbol`. Decode as a `google.protobuf.EnumDescriptorProto`. -final $typed_data.Uint8List moneySymbolDescriptor = $convert.base64Decode('CgtNb25leVN5bWJvbBIHCgNDTlkQABIHCgNFVVIQARIHCgNVU0QQAg=='); -@$core.Deprecated('Use richTextDescriptionDescriptor instead') -const RichTextDescription$json = const { - '1': 'RichTextDescription', - '2': const [ - const {'1': 'format', '3': 1, '4': 1, '5': 9, '10': 'format'}, - ], -}; - -/// Descriptor for `RichTextDescription`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List richTextDescriptionDescriptor = $convert.base64Decode('ChNSaWNoVGV4dERlc2NyaXB0aW9uEhYKBmZvcm1hdBgBIAEoCVIGZm9ybWF0'); -@$core.Deprecated('Use checkboxDescriptionDescriptor instead') -const CheckboxDescription$json = const { - '1': 'CheckboxDescription', - '2': const [ - const {'1': 'is_selected', '3': 1, '4': 1, '5': 8, '10': 'isSelected'}, - ], -}; - -/// Descriptor for `CheckboxDescription`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List checkboxDescriptionDescriptor = $convert.base64Decode('ChNDaGVja2JveERlc2NyaXB0aW9uEh8KC2lzX3NlbGVjdGVkGAEgASgIUgppc1NlbGVjdGVk'); -@$core.Deprecated('Use dateDescriptionDescriptor instead') -const DateDescription$json = const { - '1': 'DateDescription', - '2': const [ - const {'1': 'date_format', '3': 1, '4': 1, '5': 14, '6': '.DateFormat', '10': 'dateFormat'}, - const {'1': 'time_format', '3': 2, '4': 1, '5': 14, '6': '.TimeFormat', '10': 'timeFormat'}, - ], -}; - -/// Descriptor for `DateDescription`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List dateDescriptionDescriptor = $convert.base64Decode('Cg9EYXRlRGVzY3JpcHRpb24SLAoLZGF0ZV9mb3JtYXQYASABKA4yCy5EYXRlRm9ybWF0UgpkYXRlRm9ybWF0EiwKC3RpbWVfZm9ybWF0GAIgASgOMgsuVGltZUZvcm1hdFIKdGltZUZvcm1hdA=='); -@$core.Deprecated('Use singleSelectDescriptionDescriptor instead') -const SingleSelectDescription$json = const { - '1': 'SingleSelectDescription', - '2': const [ - const {'1': 'options', '3': 1, '4': 3, '5': 11, '6': '.SelectOption', '10': 'options'}, - const {'1': 'disable_color', '3': 2, '4': 1, '5': 8, '10': 'disableColor'}, - ], -}; - -/// Descriptor for `SingleSelectDescription`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List singleSelectDescriptionDescriptor = $convert.base64Decode('ChdTaW5nbGVTZWxlY3REZXNjcmlwdGlvbhInCgdvcHRpb25zGAEgAygLMg0uU2VsZWN0T3B0aW9uUgdvcHRpb25zEiMKDWRpc2FibGVfY29sb3IYAiABKAhSDGRpc2FibGVDb2xvcg=='); -@$core.Deprecated('Use multiSelectDescriptionDescriptor instead') -const MultiSelectDescription$json = const { - '1': 'MultiSelectDescription', - '2': const [ - const {'1': 'options', '3': 1, '4': 3, '5': 11, '6': '.SelectOption', '10': 'options'}, - const {'1': 'disable_color', '3': 2, '4': 1, '5': 8, '10': 'disableColor'}, - ], -}; - -/// Descriptor for `MultiSelectDescription`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List multiSelectDescriptionDescriptor = $convert.base64Decode('ChZNdWx0aVNlbGVjdERlc2NyaXB0aW9uEicKB29wdGlvbnMYASADKAsyDS5TZWxlY3RPcHRpb25SB29wdGlvbnMSIwoNZGlzYWJsZV9jb2xvchgCIAEoCFIMZGlzYWJsZUNvbG9y'); -@$core.Deprecated('Use selectOptionDescriptor instead') -const SelectOption$json = const { - '1': 'SelectOption', - '2': const [ - const {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'}, - const {'1': 'name', '3': 2, '4': 1, '5': 9, '10': 'name'}, - const {'1': 'color', '3': 3, '4': 1, '5': 9, '10': 'color'}, - ], -}; - -/// Descriptor for `SelectOption`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List selectOptionDescriptor = $convert.base64Decode('CgxTZWxlY3RPcHRpb24SDgoCaWQYASABKAlSAmlkEhIKBG5hbWUYAiABKAlSBG5hbWUSFAoFY29sb3IYAyABKAlSBWNvbG9y'); -@$core.Deprecated('Use numberDescriptionDescriptor instead') -const NumberDescription$json = const { - '1': 'NumberDescription', - '2': const [ - const {'1': 'money', '3': 1, '4': 1, '5': 14, '6': '.MoneySymbol', '10': 'money'}, - const {'1': 'scale', '3': 2, '4': 1, '5': 13, '10': 'scale'}, - const {'1': 'symbol', '3': 3, '4': 1, '5': 9, '10': 'symbol'}, - const {'1': 'sign_positive', '3': 4, '4': 1, '5': 8, '10': 'signPositive'}, - const {'1': 'name', '3': 5, '4': 1, '5': 9, '10': 'name'}, - ], -}; - -/// Descriptor for `NumberDescription`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List numberDescriptionDescriptor = $convert.base64Decode('ChFOdW1iZXJEZXNjcmlwdGlvbhIiCgVtb25leRgBIAEoDjIMLk1vbmV5U3ltYm9sUgVtb25leRIUCgVzY2FsZRgCIAEoDVIFc2NhbGUSFgoGc3ltYm9sGAMgASgJUgZzeW1ib2wSIwoNc2lnbl9wb3NpdGl2ZRgEIAEoCFIMc2lnblBvc2l0aXZlEhIKBG5hbWUYBSABKAlSBG5hbWU='); diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/type_options.pbserver.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/type_options.pbserver.dart deleted file mode 100644 index b46de00bf5..0000000000 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/type_options.pbserver.dart +++ /dev/null @@ -1,9 +0,0 @@ -/// -// Generated code. Do not modify. -// source: type_options.proto -// -// @dart = 2.12 -// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package - -export 'type_options.pb.dart'; - diff --git a/frontend/app_flowy/pubspec.yaml b/frontend/app_flowy/pubspec.yaml index 61b69b45f1..2cc96e75d6 100644 --- a/frontend/app_flowy/pubspec.yaml +++ b/frontend/app_flowy/pubspec.yaml @@ -112,6 +112,7 @@ flutter: - assets/images/home/ - assets/images/editor/ - assets/images/grid/ + - assets/images/grid/field/ - assets/translations/ # - images/a_dot_ham.jpeg diff --git a/frontend/rust-lib/flowy-grid/src/event_handler.rs b/frontend/rust-lib/flowy-grid/src/event_handler.rs index 59e3aa2a39..39d6bf2e95 100644 --- a/frontend/rust-lib/flowy-grid/src/event_handler.rs +++ b/frontend/rust-lib/flowy-grid/src/event_handler.rs @@ -71,6 +71,17 @@ pub(crate) async fn create_field_handler( Ok(()) } +#[tracing::instrument(level = "debug", skip(data, manager), err)] +pub(crate) async fn create_default_field_handler( + data: Data, + manager: AppData>, +) -> DataResult { + let grid_id: GridId = data.into_inner(); + let editor = manager.get_grid_editor(grid_id.as_ref())?; + let field = editor.make_default_field().await?; + data_result(field) +} + #[tracing::instrument(level = "debug", skip(data, manager), err)] pub(crate) async fn get_row_handler( data: Data, diff --git a/frontend/rust-lib/flowy-grid/src/event_map.rs b/frontend/rust-lib/flowy-grid/src/event_map.rs index 944c58d13b..8c08d547ff 100644 --- a/frontend/rust-lib/flowy-grid/src/event_map.rs +++ b/frontend/rust-lib/flowy-grid/src/event_map.rs @@ -13,6 +13,7 @@ pub fn create(grid_manager: Arc) -> Module { .event(GridEvent::GetFields, get_fields_handler) .event(GridEvent::UpdateField, update_field_handler) .event(GridEvent::CreateField, create_field_handler) + .event(GridEvent::CreateDefaultField, create_default_field_handler) .event(GridEvent::CreateRow, create_row_handler) .event(GridEvent::GetRow, get_row_handler) .event(GridEvent::UpdateCell, update_cell_handler); @@ -38,6 +39,9 @@ pub enum GridEvent { #[event(input = "CreateFieldPayload")] CreateField = 12, + #[event(input = "GridId", output = "Field")] + CreateDefaultField = 13, + #[event(input = "CreateRowPayload", output = "Row")] CreateRow = 21, diff --git a/frontend/rust-lib/flowy-grid/src/protobuf/model/event_map.rs b/frontend/rust-lib/flowy-grid/src/protobuf/model/event_map.rs index 0ba8fdebc4..4e0008c7a0 100644 --- a/frontend/rust-lib/flowy-grid/src/protobuf/model/event_map.rs +++ b/frontend/rust-lib/flowy-grid/src/protobuf/model/event_map.rs @@ -30,6 +30,7 @@ pub enum GridEvent { GetFields = 10, UpdateField = 11, CreateField = 12, + CreateDefaultField = 13, CreateRow = 21, GetRow = 22, UpdateCell = 30, @@ -47,6 +48,7 @@ impl ::protobuf::ProtobufEnum for GridEvent { 10 => ::std::option::Option::Some(GridEvent::GetFields), 11 => ::std::option::Option::Some(GridEvent::UpdateField), 12 => ::std::option::Option::Some(GridEvent::CreateField), + 13 => ::std::option::Option::Some(GridEvent::CreateDefaultField), 21 => ::std::option::Option::Some(GridEvent::CreateRow), 22 => ::std::option::Option::Some(GridEvent::GetRow), 30 => ::std::option::Option::Some(GridEvent::UpdateCell), @@ -61,6 +63,7 @@ impl ::protobuf::ProtobufEnum for GridEvent { GridEvent::GetFields, GridEvent::UpdateField, GridEvent::CreateField, + GridEvent::CreateDefaultField, GridEvent::CreateRow, GridEvent::GetRow, GridEvent::UpdateCell, @@ -92,11 +95,11 @@ impl ::protobuf::reflect::ProtobufValue for GridEvent { } static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x0fevent_map.proto*\x8b\x01\n\tGridEvent\x12\x0f\n\x0bGetGridData\x10\ + \n\x0fevent_map.proto*\xa3\x01\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\x0f\n\x0bCreateField\x10\x0c\x12\r\n\tCreate\ - Row\x10\x15\x12\n\n\x06GetRow\x10\x16\x12\x0e\n\nUpdateCell\x10\x1eb\x06\ - proto3\ + \x0bUpdateField\x10\x0b\x12\x0f\n\x0bCreateField\x10\x0c\x12\x16\n\x12Cr\ + eateDefaultField\x10\r\x12\r\n\tCreateRow\x10\x15\x12\n\n\x06GetRow\x10\ + \x16\x12\x0e\n\nUpdateCell\x10\x1eb\x06proto3\ "; static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT; diff --git a/frontend/rust-lib/flowy-grid/src/protobuf/model/mod.rs b/frontend/rust-lib/flowy-grid/src/protobuf/model/mod.rs index 2e768a115b..8408c120c1 100644 --- a/frontend/rust-lib/flowy-grid/src/protobuf/model/mod.rs +++ b/frontend/rust-lib/flowy-grid/src/protobuf/model/mod.rs @@ -4,9 +4,6 @@ mod number_type_option; pub use number_type_option::*; -mod text_description; -pub use text_description::*; - mod dart_notification; pub use dart_notification::*; @@ -19,5 +16,8 @@ pub use checkbox_type_option::*; mod event_map; pub use event_map::*; +mod text_type_option; +pub use text_type_option::*; + mod date_type_option; pub use date_type_option::*; diff --git a/frontend/rust-lib/flowy-grid/src/protobuf/model/text_description.rs b/frontend/rust-lib/flowy-grid/src/protobuf/model/text_type_option.rs similarity index 98% rename from frontend/rust-lib/flowy-grid/src/protobuf/model/text_description.rs rename to frontend/rust-lib/flowy-grid/src/protobuf/model/text_type_option.rs index 2bedb36f63..febc180e03 100644 --- a/frontend/rust-lib/flowy-grid/src/protobuf/model/text_description.rs +++ b/frontend/rust-lib/flowy-grid/src/protobuf/model/text_type_option.rs @@ -17,7 +17,7 @@ #![allow(trivial_casts)] #![allow(unused_imports)] #![allow(unused_results)] -//! Generated file from `text_description.proto` +//! Generated file from `text_type_option.proto` /// Generated files are compatible only with the same version /// of protobuf runtime. @@ -183,7 +183,7 @@ impl ::protobuf::reflect::ProtobufValue for RichTextTypeOption { } static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x16text_description.proto\",\n\x12RichTextTypeOption\x12\x16\n\x06for\ + \n\x16text_type_option.proto\",\n\x12RichTextTypeOption\x12\x16\n\x06for\ mat\x18\x01\x20\x01(\tR\x06formatb\x06proto3\ "; diff --git a/frontend/rust-lib/flowy-grid/src/protobuf/proto/event_map.proto b/frontend/rust-lib/flowy-grid/src/protobuf/proto/event_map.proto index 9a2177b6f4..894b2a111a 100644 --- a/frontend/rust-lib/flowy-grid/src/protobuf/proto/event_map.proto +++ b/frontend/rust-lib/flowy-grid/src/protobuf/proto/event_map.proto @@ -6,6 +6,7 @@ enum GridEvent { GetFields = 10; UpdateField = 11; CreateField = 12; + CreateDefaultField = 13; CreateRow = 21; GetRow = 22; UpdateCell = 30; diff --git a/frontend/rust-lib/flowy-grid/src/protobuf/proto/text_description.proto b/frontend/rust-lib/flowy-grid/src/protobuf/proto/text_type_option.proto similarity index 100% rename from frontend/rust-lib/flowy-grid/src/protobuf/proto/text_description.proto rename to frontend/rust-lib/flowy-grid/src/protobuf/proto/text_type_option.proto diff --git a/frontend/rust-lib/flowy-grid/src/services/field/field_builder.rs b/frontend/rust-lib/flowy-grid/src/services/field/field_builder.rs index 14206f9254..64f5e40ee4 100644 --- a/frontend/rust-lib/flowy-grid/src/services/field/field_builder.rs +++ b/frontend/rust-lib/flowy-grid/src/services/field/field_builder.rs @@ -1,19 +1,25 @@ +use crate::services::field::type_options::*; use flowy_grid_data_model::entities::{FieldMeta, FieldType}; pub struct FieldBuilder { field_meta: FieldMeta, - type_options_builder: Box, + type_option_builder: Box, } impl FieldBuilder { - pub fn new(type_options_builder: T) -> Self { - let field_meta = FieldMeta::new("Name", "", FieldType::RichText); + pub fn new(type_option_builder: T) -> Self { + let field_meta = FieldMeta::new("", "", type_option_builder.field_type()); Self { field_meta, - type_options_builder: Box::new(type_options_builder), + type_option_builder: Box::new(type_option_builder), } } + pub fn from_field_type(field_type: &FieldType) -> Self { + let type_option_builder = type_option_builder_from_type(field_type); + Self::new(type_option_builder) + } + pub fn name(mut self, name: &str) -> Self { self.field_meta.name = name.to_owned(); self @@ -24,11 +30,6 @@ impl FieldBuilder { self } - pub fn field_type(mut self, field_type: FieldType) -> Self { - self.field_meta.field_type = field_type; - self - } - pub fn visibility(mut self, visibility: bool) -> Self { self.field_meta.visibility = visibility; self @@ -45,9 +46,8 @@ impl FieldBuilder { } pub fn build(mut self) -> FieldMeta { - assert_eq!(self.field_meta.field_type, self.type_options_builder.field_type()); - - let type_options = self.type_options_builder.build(); + debug_assert_eq!(self.field_meta.field_type, self.type_option_builder.field_type()); + let type_options = self.type_option_builder.build(); self.field_meta.type_option = type_options; self.field_meta } @@ -57,3 +57,27 @@ pub trait TypeOptionsBuilder { fn field_type(&self) -> FieldType; fn build(&self) -> String; } + +pub fn type_option_builder_from_type(field_type: &FieldType) -> Box { + match field_type { + FieldType::RichText => Box::new(RichTextTypeOptionBuilder::default()), + FieldType::Number => Box::new(NumberTypeOptionBuilder::default()), + FieldType::DateTime => Box::new(DateTypeOptionBuilder::default()), + FieldType::SingleSelect => Box::new(SingleSelectTypeOptionBuilder::default()), + FieldType::MultiSelect => Box::new(MultiSelectTypeOptionBuilder::default()), + FieldType::Checkbox => Box::new(CheckboxTypeOptionBuilder::default()), + } +} + +impl TypeOptionsBuilder for Box +where + T: TypeOptionsBuilder + ?Sized, +{ + fn field_type(&self) -> FieldType { + (**self).field_type() + } + + fn build(&self) -> String { + (**self).build() + } +} diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/checkbox_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/checkbox_type_option.rs index da6d057c03..08ae9f79c8 100644 --- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/checkbox_type_option.rs +++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/checkbox_type_option.rs @@ -7,15 +7,15 @@ use flowy_grid_data_model::entities::{FieldMeta, FieldType}; use serde::{Deserialize, Serialize}; #[derive(Default)] -pub struct CheckboxTypeOptionsBuilder(CheckboxTypeOption); -impl CheckboxTypeOptionsBuilder { +pub struct CheckboxTypeOptionBuilder(CheckboxTypeOption); +impl CheckboxTypeOptionBuilder { pub fn set_selected(mut self, is_selected: bool) -> Self { self.0.is_selected = is_selected; self } } -impl TypeOptionsBuilder for CheckboxTypeOptionsBuilder { +impl TypeOptionsBuilder for CheckboxTypeOptionBuilder { fn field_type(&self) -> FieldType { self.0.field_type() } @@ -66,7 +66,7 @@ mod tests { #[test] fn checkout_box_description_test() { - let description = CheckboxTypeOption::default(); + let type_option = CheckboxTypeOption::default(); assert_eq!(description.serialize_cell_data("true").unwrap(), "1".to_owned()); assert_eq!(description.serialize_cell_data("1").unwrap(), "1".to_owned()); assert_eq!(description.serialize_cell_data("yes").unwrap(), "1".to_owned()); diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/date_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/date_type_option.rs index 8c8fec6a86..20d94c8ca8 100644 --- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/date_type_option.rs +++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/date_type_option.rs @@ -63,8 +63,8 @@ impl CellDataSerde for DateTypeOption { } #[derive(Default)] -pub struct DateTypeOptionsBuilder(DateTypeOption); -impl DateTypeOptionsBuilder { +pub struct DateTypeOptionBuilder(DateTypeOption); +impl DateTypeOptionBuilder { pub fn date_format(mut self, date_format: DateFormat) -> Self { self.0.date_format = date_format; self @@ -75,7 +75,7 @@ impl DateTypeOptionsBuilder { self } } -impl TypeOptionsBuilder for DateTypeOptionsBuilder { +impl TypeOptionsBuilder for DateTypeOptionBuilder { fn field_type(&self) -> FieldType { self.0.field_type() } @@ -258,7 +258,7 @@ mod tests { #[test] #[should_panic] fn date_description_invalid_data_test() { - let description = DateTypeOption::default(); + let type_option = DateTypeOption::default(); description.serialize_cell_data("he").unwrap(); } } diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/mod.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/mod.rs index 51d06fff19..958edf2664 100644 --- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/mod.rs +++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/mod.rs @@ -2,10 +2,10 @@ mod checkbox_type_option; mod date_type_option; mod number_type_option; mod selection_type_option; -mod text_description; +mod text_type_option; pub use checkbox_type_option::*; pub use date_type_option::*; pub use number_type_option::*; pub use selection_type_option::*; -pub use text_description::*; +pub use text_type_option::*; diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/number_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/number_type_option.rs index 64783cda2b..5fa74285df 100644 --- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/number_type_option.rs +++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/number_type_option.rs @@ -19,9 +19,9 @@ lazy_static! { } #[derive(Default)] -pub struct NumberTypeOptionsBuilder(NumberTypeOption); +pub struct NumberTypeOptionBuilder(NumberTypeOption); -impl NumberTypeOptionsBuilder { +impl NumberTypeOptionBuilder { pub fn name(mut self, name: &str) -> Self { self.0.name = name.to_string(); self @@ -43,7 +43,7 @@ impl NumberTypeOptionsBuilder { } } -impl TypeOptionsBuilder for NumberTypeOptionsBuilder { +impl TypeOptionsBuilder for NumberTypeOptionBuilder { fn field_type(&self) -> FieldType { self.0.field_type() } diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option.rs index af5e58119f..5c4a3c5141 100644 --- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option.rs +++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option.rs @@ -33,15 +33,15 @@ impl CellDataSerde for SingleSelectTypeOption { } #[derive(Default)] -pub struct SingleSelectTypeOptionsBuilder(SingleSelectTypeOption); +pub struct SingleSelectTypeOptionBuilder(SingleSelectTypeOption); -impl SingleSelectTypeOptionsBuilder { +impl SingleSelectTypeOptionBuilder { pub fn option(mut self, opt: SelectOption) -> Self { self.0.options.push(opt); self } } -impl TypeOptionsBuilder for SingleSelectTypeOptionsBuilder { +impl TypeOptionsBuilder for SingleSelectTypeOptionBuilder { fn field_type(&self) -> FieldType { self.0.field_type() } @@ -72,15 +72,15 @@ impl CellDataSerde for MultiSelectTypeOption { } #[derive(Default)] -pub struct MultiSelectTypeOptionsBuilder(MultiSelectTypeOption); -impl MultiSelectTypeOptionsBuilder { +pub struct MultiSelectTypeOptionBuilder(MultiSelectTypeOption); +impl MultiSelectTypeOptionBuilder { pub fn option(mut self, opt: SelectOption) -> Self { self.0.options.push(opt); self } } -impl TypeOptionsBuilder for MultiSelectTypeOptionsBuilder { +impl TypeOptionsBuilder for MultiSelectTypeOptionBuilder { fn field_type(&self) -> FieldType { self.0.field_type() } @@ -157,10 +157,10 @@ mod tests { #[test] #[should_panic] fn selection_description_test() { - let description = SingleSelectTypeOption::default(); + let type_option = SingleSelectTypeOption::default(); assert_eq!(description.serialize_cell_data("1,2,3").unwrap(), "1".to_owned()); - let description = MultiSelectDescription::default(); + let type_option = MultiSelectDescription::default(); assert_eq!(description.serialize_cell_data("1,2,3").unwrap(), "1,2,3".to_owned()); } } diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/text_description.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/text_type_option.rs similarity index 90% rename from frontend/rust-lib/flowy-grid/src/services/field/type_options/text_description.rs rename to frontend/rust-lib/flowy-grid/src/services/field/type_options/text_type_option.rs index 9b6b988fc0..dc7e0e56d0 100644 --- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/text_description.rs +++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/text_type_option.rs @@ -8,9 +8,9 @@ use flowy_grid_data_model::entities::{FieldMeta, FieldType}; use serde::{Deserialize, Serialize}; #[derive(Default)] -pub struct RichTextTypeOptionsBuilder(RichTextTypeOption); +pub struct RichTextTypeOptionBuilder(RichTextTypeOption); -impl TypeOptionsBuilder for RichTextTypeOptionsBuilder { +impl TypeOptionsBuilder for RichTextTypeOptionBuilder { fn field_type(&self) -> FieldType { self.0.field_type() } diff --git a/frontend/rust-lib/flowy-grid/src/services/grid_editor.rs b/frontend/rust-lib/flowy-grid/src/services/grid_editor.rs index 80768c5251..2582ad77b0 100644 --- a/frontend/rust-lib/flowy-grid/src/services/grid_editor.rs +++ b/frontend/rust-lib/flowy-grid/src/services/grid_editor.rs @@ -1,25 +1,19 @@ +use crate::dart_notification::{send_dart_notification, GridNotification}; use crate::manager::GridUser; use crate::services::block_meta_editor::GridBlockMetaEditorManager; +use crate::services::field::{type_option_builder_from_type, FieldBuilder}; +use crate::services::row::*; use bytes::Bytes; use flowy_error::{FlowyError, FlowyResult}; -use flowy_grid_data_model::entities::{ - CellMetaChangeset, Field, FieldChangeset, FieldMeta, Grid, GridBlockMeta, GridBlockMetaChangeset, GridBlockOrder, - RepeatedField, RepeatedFieldOrder, RepeatedGridBlock, RepeatedRow, Row, RowMeta, RowMetaChangeset, RowOrder, -}; +use flowy_grid_data_model::entities::*; +use flowy_grid_data_model::parser::CreateFieldParams; +use flowy_revision::{RevisionCloudService, RevisionCompactor, RevisionManager, RevisionObjectBuilder}; use flowy_sync::client_grid::{GridChangeset, GridMetaPad}; use flowy_sync::entities::revision::Revision; use flowy_sync::util::make_delta_from_revisions; -use std::collections::HashMap; - -use crate::dart_notification::{send_dart_notification, GridNotification}; -use crate::services::row::{ - make_grid_block_from_block_metas, make_grid_blocks, make_row_meta_from_context, make_rows_from_row_metas, - serialize_cell_data, CreateRowMetaBuilder, CreateRowMetaPayload, GridBlockMetaData, -}; -use flowy_grid_data_model::parser::CreateFieldParams; -use flowy_revision::{RevisionCloudService, RevisionCompactor, RevisionManager, RevisionObjectBuilder}; use lib_infra::future::FutureResult; use lib_ot::core::PlainTextAttributes; +use std::collections::HashMap; use std::sync::Arc; use tokio::sync::RwLock; @@ -55,12 +49,25 @@ impl ClientGridEditor { })) } - pub async fn create_field(&self, params: CreateFieldParams) -> FlowyResult<()> { + pub async fn create_field(&self, mut params: CreateFieldParams) -> FlowyResult<()> { + if params.type_option_data.is_empty() { + params.type_option_data = type_option_builder_from_type(¶ms.field.field_type) + .build() + .as_bytes() + .to_vec(); + } + let _ = self.modify(|grid| Ok(grid.create_field(params)?)).await?; let _ = self.notify_did_update_fields().await?; Ok(()) } + pub async fn make_default_field(&self) -> FlowyResult { + let field_type = FieldType::default(); + let field_meta = FieldBuilder::from_field_type(&field_type).build(); + Ok(field_meta.into()) + } + pub async fn contain_field(&self, field_id: &str) -> bool { self.pad.read().await.contain_field(field_id) } diff --git a/frontend/rust-lib/flowy-grid/src/util.rs b/frontend/rust-lib/flowy-grid/src/util.rs index 9349854433..1638060f61 100644 --- a/frontend/rust-lib/flowy-grid/src/util.rs +++ b/frontend/rust-lib/flowy-grid/src/util.rs @@ -3,22 +3,17 @@ use flowy_grid_data_model::entities::{BuildGridContext, FieldType}; use flowy_sync::client_grid::GridBuilder; pub fn make_default_grid() -> BuildGridContext { - let text_field = FieldBuilder::new(RichTextTypeOptionsBuilder::default()) + let text_field = FieldBuilder::new(RichTextTypeOptionBuilder::default()) .name("Name") .visibility(true) - .field_type(FieldType::RichText) .build(); - let single_select = SingleSelectTypeOptionsBuilder::default() + let single_select = SingleSelectTypeOptionBuilder::default() .option(SelectOption::new("Done")) .option(SelectOption::new("Unknown")) .option(SelectOption::new("Progress")); - let single_select_field = FieldBuilder::new(single_select) - .name("Status") - .visibility(true) - .field_type(FieldType::SingleSelect) - .build(); + let single_select_field = FieldBuilder::new(single_select).name("Status").visibility(true).build(); GridBuilder::default() .add_field(text_field) diff --git a/frontend/rust-lib/flowy-grid/tests/grid/grid_test.rs b/frontend/rust-lib/flowy-grid/tests/grid/grid_test.rs index 803c2409a9..4cda3a599e 100644 --- a/frontend/rust-lib/flowy-grid/tests/grid/grid_test.rs +++ b/frontend/rust-lib/flowy-grid/tests/grid/grid_test.rs @@ -253,13 +253,13 @@ async fn grid_row_add_cells_test() { builder.add_cell(&field.id, data).unwrap(); } FieldType::SingleSelect => { - let description = SingleSelectTypeOption::from(field); + let type_option = SingleSelectTypeOption::from(field); let options = description.options.first().unwrap(); let data = description.serialize_cell_data(&options.id).unwrap(); builder.add_cell(&field.id, data).unwrap(); } FieldType::MultiSelect => { - let description = MultiSelectTypeOption::from(field); + let type_option = MultiSelectTypeOption::from(field); let options = description .options .iter() @@ -382,11 +382,11 @@ async fn grid_cell_update() { FieldType::Number => "123".to_string(), FieldType::DateTime => "123".to_string(), FieldType::SingleSelect => { - let description = SingleSelectTypeOption::from(field_meta); + let type_option = SingleSelectTypeOption::from(field_meta); description.options.first().unwrap().id.clone() } FieldType::MultiSelect => { - let description = MultiSelectTypeOption::from(field_meta); + let type_option = MultiSelectTypeOption::from(field_meta); description.options.first().unwrap().id.clone() } FieldType::Checkbox => "1".to_string(), diff --git a/frontend/rust-lib/flowy-grid/tests/grid/script.rs b/frontend/rust-lib/flowy-grid/tests/grid/script.rs index fa25ef3e78..d622d3acbe 100644 --- a/frontend/rust-lib/flowy-grid/tests/grid/script.rs +++ b/frontend/rust-lib/flowy-grid/tests/grid/script.rs @@ -248,10 +248,9 @@ async fn get_row_metas(editor: &Arc) -> Vec> { } pub fn create_text_field(grid_id: &str) -> (CreateFieldParams, FieldMeta) { - let field_meta = FieldBuilder::new(RichTextTypeOptionsBuilder::default()) + let field_meta = FieldBuilder::new(RichTextTypeOptionBuilder::default()) .name("Name") .visibility(true) - .field_type(FieldType::RichText) .build(); let cloned_field_meta = field_meta.clone(); @@ -276,16 +275,11 @@ pub fn create_text_field(grid_id: &str) -> (CreateFieldParams, FieldMeta) { } pub fn create_single_select_field(grid_id: &str) -> (CreateFieldParams, FieldMeta) { - let single_select = SingleSelectTypeOptionsBuilder::default() + let single_select = SingleSelectTypeOptionBuilder::default() .option(SelectOption::new("Done")) .option(SelectOption::new("Progress")); - let field_meta = FieldBuilder::new(single_select) - .name("Name") - .visibility(true) - .field_type(FieldType::SingleSelect) - .build(); - + let field_meta = FieldBuilder::new(single_select).name("Name").visibility(true).build(); let cloned_field_meta = field_meta.clone(); let field = Field { @@ -308,60 +302,42 @@ pub fn create_single_select_field(grid_id: &str) -> (CreateFieldParams, FieldMet } fn make_template_1_grid() -> BuildGridContext { - let text_field = FieldBuilder::new(RichTextTypeOptionsBuilder::default()) + let text_field = FieldBuilder::new(RichTextTypeOptionBuilder::default()) .name("Name") .visibility(true) - .field_type(FieldType::RichText) .build(); // Single Select - let single_select = SingleSelectTypeOptionsBuilder::default() + let single_select = SingleSelectTypeOptionBuilder::default() .option(SelectOption::new("Live")) .option(SelectOption::new("Completed")) .option(SelectOption::new("Planned")) .option(SelectOption::new("Paused")); - let single_select_field = FieldBuilder::new(single_select) - .name("Status") - .visibility(true) - .field_type(FieldType::SingleSelect) - .build(); + let single_select_field = FieldBuilder::new(single_select).name("Status").visibility(true).build(); // MultiSelect - let multi_select = MultiSelectTypeOptionsBuilder::default() + let multi_select = MultiSelectTypeOptionBuilder::default() .option(SelectOption::new("Google")) .option(SelectOption::new("Facebook")) .option(SelectOption::new("Twitter")); let multi_select_field = FieldBuilder::new(multi_select) .name("Platform") .visibility(true) - .field_type(FieldType::MultiSelect) .build(); // Number - let number = NumberTypeOptionsBuilder::default().set_format(NumberFormat::USD); - let number_field = FieldBuilder::new(number) - .name("Price") - .visibility(true) - .field_type(FieldType::Number) - .build(); + let number = NumberTypeOptionBuilder::default().set_format(NumberFormat::USD); + let number_field = FieldBuilder::new(number).name("Price").visibility(true).build(); // Date - let date = DateTypeOptionsBuilder::default() + let date = DateTypeOptionBuilder::default() .date_format(DateFormat::US) .time_format(TimeFormat::TwentyFourHour); - let date_field = FieldBuilder::new(date) - .name("Time") - .visibility(true) - .field_type(FieldType::DateTime) - .build(); + let date_field = FieldBuilder::new(date).name("Time").visibility(true).build(); // Checkbox - let checkbox = CheckboxTypeOptionsBuilder::default(); - let checkbox_field = FieldBuilder::new(checkbox) - .name("is done") - .visibility(true) - .field_type(FieldType::Checkbox) - .build(); + let checkbox = CheckboxTypeOptionBuilder::default(); + let checkbox_field = FieldBuilder::new(checkbox).name("is done").visibility(true).build(); GridBuilder::default() .add_field(text_field) diff --git a/shared-lib/flowy-grid-data-model/src/parser/grid_params.rs b/shared-lib/flowy-grid-data-model/src/parser/grid_params.rs index bfcb802c22..83f0395f53 100644 --- a/shared-lib/flowy-grid-data-model/src/parser/grid_params.rs +++ b/shared-lib/flowy-grid-data-model/src/parser/grid_params.rs @@ -102,10 +102,6 @@ impl TryInto for CreateFieldPayload { Some(id) => Some(NotEmptyUuid::parse(id).map_err(|_| ErrorCode::FieldIdIsEmpty)?.0), }; - if self.type_option_data.is_empty() { - return Err(ErrorCode::TypeOptionIsEmpty); - } - Ok(CreateFieldParams { grid_id: grid_id.0, field: self.field, diff --git a/shared-lib/flowy-sync/src/client_grid/grid_meta_pad.rs b/shared-lib/flowy-sync/src/client_grid/grid_meta_pad.rs index 372433cd34..06ecf07030 100644 --- a/shared-lib/flowy-sync/src/client_grid/grid_meta_pad.rs +++ b/shared-lib/flowy-sync/src/client_grid/grid_meta_pad.rs @@ -45,16 +45,18 @@ impl GridMetaPad { .. } = params; + // Check if the field exists or not if grid .fields .iter() .find(|field_meta| field_meta.id == field.id) .is_some() { - tracing::warn!("Create grid field"); + tracing::warn!("Duplicate grid field"); return Ok(None); } + // Parse type option let type_option = String::from_utf8(type_option_data).map_err(|e| CollaborateError::internal().context(e))?;