From 477fa5f4f646e7d075ecc04460826ec112fe088e Mon Sep 17 00:00:00 2001 From: appflowy Date: Thu, 3 Mar 2022 22:17:07 +0800 Subject: [PATCH] feat: config grid bloc --- .../workspace/application/grid/grid_bloc.dart | 82 +- .../application/grid/grid_service.dart | 10 +- .../plugins/grid/grid_layout.dart | 10 +- .../presentation/plugins/grid/grid_page.dart | 10 +- .../widgets/grid_content/cell_builder.dart | 6 +- .../widgets/grid_content/cell_container.dart | 3 +- .../grid/widgets/grid_content/grid_cell.dart | 48 +- .../grid/widgets/grid_content/grid_row.dart | 20 +- .../grid/widgets/grid_header/header.dart | 60 + .../grid/widgets/grid_header/header_cell.dart | 2 +- .../dart_event/flowy-grid/dart_event.dart | 51 + .../flowy-grid-data-model/grid.pb.dart | 340 ++-- .../flowy-grid-data-model/grid.pbjson.dart | 85 +- .../lib/protobuf/flowy-grid/cell_data.pb.dart | 458 +++++ .../protobuf/flowy-grid/cell_data.pbenum.dart | 62 + .../protobuf/flowy-grid/cell_data.pbjson.dart | 125 ++ .../flowy-grid/cell_data.pbserver.dart | 9 + .../protobuf/flowy-grid/event_map.pbenum.dart | 6 + .../protobuf/flowy-grid/event_map.pbjson.dart | 5 +- .../lib/protobuf/flowy-grid/protobuf.dart | 1 + frontend/rust-lib/Cargo.lock | 47 +- frontend/rust-lib/flowy-grid/Cargo.toml | 6 + frontend/rust-lib/flowy-grid/Flowy.toml | 2 +- .../flowy-grid/src/cell_service/cell_data.rs | 469 +++++ .../flowy-grid/src/cell_service/mod.rs | 5 + .../flowy-grid/src/cell_service/stringify.rs | 30 + .../flowy-grid/src/cell_service/util.rs | 129 ++ .../rust-lib/flowy-grid/src/event_handler.rs | 38 +- frontend/rust-lib/flowy-grid/src/event_map.rs | 15 +- frontend/rust-lib/flowy-grid/src/lib.rs | 4 + frontend/rust-lib/flowy-grid/src/macros.rs | 64 + .../src/protobuf/model/cell_data.rs | 1655 +++++++++++++++++ .../src/protobuf/model/event_map.rs | 14 +- .../flowy-grid/src/protobuf/model/mod.rs | 3 + .../src/protobuf/proto/cell_data.proto | 47 + .../src/protobuf/proto/event_map.proto | 3 + shared-lib/Cargo.lock | 2 + shared-lib/flowy-grid-data-model/Cargo.toml | 2 + .../src/entities/grid.rs | 90 +- .../src/protobuf/model/grid.rs | 1069 +++++------ .../src/protobuf/proto/grid.proto | 27 +- 41 files changed, 4209 insertions(+), 905 deletions(-) create mode 100644 frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/cell_data.pb.dart create mode 100644 frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/cell_data.pbenum.dart create mode 100644 frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/cell_data.pbjson.dart create mode 100644 frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/cell_data.pbserver.dart create mode 100644 frontend/rust-lib/flowy-grid/src/cell_service/cell_data.rs create mode 100644 frontend/rust-lib/flowy-grid/src/cell_service/mod.rs create mode 100644 frontend/rust-lib/flowy-grid/src/cell_service/stringify.rs create mode 100644 frontend/rust-lib/flowy-grid/src/cell_service/util.rs create mode 100644 frontend/rust-lib/flowy-grid/src/macros.rs create mode 100644 frontend/rust-lib/flowy-grid/src/protobuf/model/cell_data.rs create mode 100644 frontend/rust-lib/flowy-grid/src/protobuf/proto/cell_data.proto diff --git a/frontend/app_flowy/lib/workspace/application/grid/grid_bloc.dart b/frontend/app_flowy/lib/workspace/application/grid/grid_bloc.dart index e6663c4515..d8da9e9d65 100644 --- a/frontend/app_flowy/lib/workspace/application/grid/grid_bloc.dart +++ b/frontend/app_flowy/lib/workspace/application/grid/grid_bloc.dart @@ -14,14 +14,17 @@ part 'grid_bloc.freezed.dart'; class GridBloc extends Bloc { final GridService service; final View view; - late Grid _grid; + late Grid? _grid; + late List? _fields; GridBloc({required this.view, required this.service}) : super(GridState.initial()) { on( (event, emit) async { await event.map( initial: (Initial value) async { - await _initial(value, emit); + await _loadGrid(emit); + await _loadFields(emit); + await _loadGridInfo(emit); }, createRow: (_CreateRow value) { service.createRow(gridId: view.id); @@ -39,12 +42,11 @@ class GridBloc extends Bloc { return super.close(); } - Future _initial(Initial value, Emitter emit) async { + Future _loadGrid(Emitter emit) async { final result = await service.openGrid(gridId: view.id); result.fold( (grid) { _grid = grid; - _loadGridInfo(emit); }, (err) { emit(state.copyWith(loadingState: GridLoadingState.finish(right(err)))); @@ -52,10 +54,36 @@ class GridBloc extends Bloc { ); } + Future _loadFields(Emitter emit) async { + if (_grid != null) { + final result = await service.getFields(fieldOrders: _grid!.fieldOrders); + result.fold( + (fields) { + _fields = fields.items; + }, + (err) { + emit(state.copyWith(loadingState: GridLoadingState.finish(right(err)))); + }, + ); + } + } + Future _loadGridInfo(Emitter emit) async { - emit( - state.copyWith(loadingState: GridLoadingState.finish(left(unit))), - ); + if (_grid != null && _fields != null) { + final result = await service.getRows(rowOrders: _grid!.rowOrders); + result.fold((repeatedRow) { + final rows = repeatedRow.items; + final gridInfo = GridInfo(rows: rows, fields: _fields!); + + emit( + state.copyWith(loadingState: GridLoadingState.finish(left(unit)), gridInfo: some(left(gridInfo))), + ); + }, (err) { + emit( + state.copyWith(loadingState: GridLoadingState.finish(right(err)), gridInfo: none()), + ); + }); + } } } @@ -87,49 +115,33 @@ class GridLoadingState with _$GridLoadingState { const factory GridLoadingState.finish(Either successOrFail) = _Finish; } -typedef FieldById = Map; -typedef RowById = Map; -typedef CellById = Map; - class GridInfo { - List rowOrders; - List fieldOrders; - RowById rowMap; - FieldById fieldMap; + List rows; + List fields; GridInfo({ - required this.rowOrders, - required this.fieldOrders, - required this.fieldMap, - required this.rowMap, + required this.rows, + required this.fields, }); RowInfo rowInfoAtIndex(int index) { - final rowOrder = rowOrders[index]; - final Row row = rowMap[rowOrder.rowId]!; - final cellMap = row.cellByFieldId; - - final displayCellMap = {}; - + final row = rows[index]; return RowInfo( - fieldOrders: fieldOrders, - fieldMap: fieldMap, - displayCellMap: displayCellMap, + fields: fields, + cellMap: row.cellByFieldId, ); } int numberOfRows() { - return rowOrders.length; + return rows.length; } } class RowInfo { - List fieldOrders; - FieldById fieldMap; - CellById displayCellMap; + List fields; + Map cellMap; RowInfo({ - required this.fieldOrders, - required this.fieldMap, - required this.displayCellMap, + required this.fields, + required this.cellMap, }); } diff --git a/frontend/app_flowy/lib/workspace/application/grid/grid_service.dart b/frontend/app_flowy/lib/workspace/application/grid/grid_service.dart index b69e4a8e5a..e725f7ac84 100644 --- a/frontend/app_flowy/lib/workspace/application/grid/grid_service.dart +++ b/frontend/app_flowy/lib/workspace/application/grid/grid_service.dart @@ -15,6 +15,14 @@ class GridService { } Future> createRow({required String gridId}) { - throw UnimplementedError(); + return GridEventCreateRow(GridId(value: gridId)).send(); + } + + Future> getRows({required RepeatedRowOrder rowOrders}) { + return GridEventGetRows(rowOrders).send(); + } + + Future> getFields({required RepeatedFieldOrder fieldOrders}) { + return GridEventGetFields(fieldOrders).send(); } } diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/grid_layout.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/grid_layout.dart index df2b73cb12..0daeacbb33 100755 --- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/grid_layout.dart +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/grid_layout.dart @@ -3,14 +3,10 @@ import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart'; import 'grid_sizes.dart'; class GridLayout { - static double headerWidth(List fieldOrders) { - if (fieldOrders.isEmpty) return 0; + static double headerWidth(List fields) { + if (fields.isEmpty) return 0; - final fieldsWidth = fieldOrders - .map( - (fieldOrder) => fieldOrder.width.toDouble(), - ) - .reduce((value, element) => value + element); + final fieldsWidth = fields.map((field) => field.width.toDouble()).reduce((value, element) => value + element); return fieldsWidth + GridSize.firstHeaderPadding; } diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/grid_page.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/grid_page.dart index 1eb102f7bb..6b72af2aa5 100755 --- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/grid_page.dart +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/grid_page.dart @@ -101,12 +101,12 @@ class _GridBodyState extends State { controller: _scrollController.horizontalController, axis: Axis.horizontal, child: SizedBox( - width: GridLayout.headerWidth(gridInfo.fieldOrders), + width: GridLayout.headerWidth(gridInfo.fields), child: CustomScrollView( physics: StyledScrollPhysics(), controller: _scrollController.verticalController, slivers: [ - _buildHeader(gridInfo.fieldOrders, gridInfo.fieldMap), + _buildHeader(gridInfo.fields), _buildRows(gridInfo), _builderFooter(context), ], @@ -123,9 +123,9 @@ class _GridBodyState extends State { ); } - Widget _buildHeader(List fieldOrders, FieldById fieldById) { + Widget _buildHeader(List fields) { return SliverPersistentHeader( - delegate: GridHeaderDelegate(fieldOrders, fieldById), + delegate: GridHeaderDelegate(fields), floating: true, pinned: true, ); @@ -135,7 +135,7 @@ class _GridBodyState extends State { return SliverList( delegate: SliverChildBuilderDelegate((context, index) { final rowInfo = gridInfo.rowInfoAtIndex(index); - return RepaintBoundary(child: GridRow(rowInfo)); + return RepaintBoundary(child: GridRowWidget(rowInfo)); }, childCount: gridInfo.numberOfRows()), ); } diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/widgets/grid_content/cell_builder.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/widgets/grid_content/cell_builder.dart index a4cab931c9..5ff1922835 100755 --- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/widgets/grid_content/cell_builder.dart +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/widgets/grid_content/cell_builder.dart @@ -2,16 +2,16 @@ import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart'; import 'grid_cell.dart'; class GridCellBuilder { - static GridCell buildCell(Field? field, DisplayCell? cell) { + static GridCellWidget buildCell(Field? field, GridCell? cell) { if (field == null || cell == null) { - return BlankCell(); + return const BlankCell(); } switch (field.fieldType) { case FieldType.RichText: return GridTextCell(cell.content); default: - return BlankCell(); + return const BlankCell(); } } } diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/widgets/grid_content/cell_container.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/widgets/grid_content/cell_container.dart index c769a60d34..1ba7c1f009 100755 --- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/widgets/grid_content/cell_container.dart +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/widgets/grid_content/cell_container.dart @@ -1,12 +1,11 @@ import 'package:app_flowy/workspace/presentation/plugins/grid/grid_sizes.dart'; import 'package:flowy_infra_ui/widget/mouse_hover_builder.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; import 'cell_decoration.dart'; import 'grid_cell.dart'; class CellContainer extends StatelessWidget { - final GridCell child; + final GridCellWidget child; final double width; const CellContainer({Key? key, required this.child, required this.width}) : super(key: key); diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/widgets/grid_content/grid_cell.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/widgets/grid_content/grid_cell.dart index a23259c8c3..93701e1ded 100755 --- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/widgets/grid_content/grid_cell.dart +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/widgets/grid_content/grid_cell.dart @@ -1,14 +1,18 @@ +import 'package:app_flowy/workspace/presentation/plugins/grid/grid_sizes.dart'; +import 'package:flowy_infra_ui/widget/mouse_hover_builder.dart'; import 'package:flutter/material.dart'; + +import 'cell_decoration.dart'; // ignore: import_of_legacy_library_into_null_safe /// The interface of base cell. -abstract class GridCell extends StatelessWidget { +abstract class GridCellWidget extends StatelessWidget { final canSelect = true; - const GridCell({Key? key}) : super(key: key); + const GridCellWidget({Key? key}) : super(key: key); } -class GridTextCell extends GridCell { +class GridTextCell extends GridCellWidget { final String content; const GridTextCell(this.content, {Key? key}) : super(key: key); @@ -18,7 +22,7 @@ class GridTextCell extends GridCell { } } -class DateCell extends GridCell { +class DateCell extends GridCellWidget { final String content; const DateCell(this.content, {Key? key}) : super(key: key); @@ -28,7 +32,7 @@ class DateCell extends GridCell { } } -class NumberCell extends GridCell { +class NumberCell extends GridCellWidget { final String content; const NumberCell(this.content, {Key? key}) : super(key: key); @@ -38,7 +42,7 @@ class NumberCell extends GridCell { } } -class SingleSelectCell extends GridCell { +class SingleSelectCell extends GridCellWidget { final String content; const SingleSelectCell(this.content, {Key? key}) : super(key: key); @@ -48,7 +52,7 @@ class SingleSelectCell extends GridCell { } } -class MultiSelectCell extends GridCell { +class MultiSelectCell extends GridCellWidget { final String content; const MultiSelectCell(this.content, {Key? key}) : super(key: key); @@ -58,7 +62,7 @@ class MultiSelectCell extends GridCell { } } -class BlankCell extends GridCell { +class BlankCell extends GridCellWidget { const BlankCell({Key? key}) : super(key: key); @override @@ -66,3 +70,31 @@ class BlankCell extends GridCell { return Container(); } } + +class RowLeading extends StatelessWidget { + const RowLeading({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + // return Expanded( + // child: Container( + // color: Colors.white10, + // width: GridSize.firstHeaderPadding, + // ), + // ); + + return GestureDetector( + behavior: HitTestBehavior.translucent, + onTap: () {}, + child: MouseHoverBuilder( + builder: (_, isHovered) => Container( + width: GridSize.firstHeaderPadding, + decoration: CellDecoration.box( + color: isHovered ? Colors.red.withOpacity(.1) : Colors.white, + ), + padding: EdgeInsets.symmetric(vertical: GridInsets.vertical, horizontal: GridInsets.horizontal), + ), + ), + ); + } +} diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/widgets/grid_content/grid_row.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/widgets/grid_content/grid_row.dart index 8a1202197e..247f9fc525 100755 --- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/widgets/grid_content/grid_row.dart +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/widgets/grid_content/grid_row.dart @@ -1,22 +1,22 @@ import 'package:app_flowy/workspace/application/grid/grid_bloc.dart'; import 'package:app_flowy/workspace/presentation/plugins/grid/grid_sizes.dart'; -import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart' hide Row; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart'; import 'package:flutter/material.dart'; import 'cell_builder.dart'; import 'cell_container.dart'; -import 'grid_row_leading.dart'; +import 'grid_cell.dart'; class GridRowContext { final RepeatedFieldOrder fieldOrders; final Map fieldById; - final Map cellByFieldId; + final Map cellByFieldId; GridRowContext(this.fieldOrders, this.fieldById, this.cellByFieldId); } -class GridRow extends StatelessWidget { +class GridRowWidget extends StatelessWidget { final RowInfo rowInfo; final Function(bool)? onHoverChange; - const GridRow(this.rowInfo, {Key? key, this.onHoverChange}) : super(key: key); + const GridRowWidget(this.rowInfo, {Key? key, this.onHoverChange}) : super(key: key); @override Widget build(BuildContext context) { @@ -48,17 +48,15 @@ class GridRow extends StatelessWidget { var cells = List.empty(growable: true); cells.add(const RowLeading()); - rowInfo.fieldOrders.where((element) => element.visibility).forEach((fieldOrder) { - final field = rowInfo.fieldMap[fieldOrder.fieldId]; - final data = rowInfo.displayCellMap[fieldOrder.fieldId]; - + for (var field in rowInfo.fields) { + final data = rowInfo.cellMap[field.id]; final cell = CellContainer( - width: fieldOrder.width.toDouble(), + width: field.width.toDouble(), child: GridCellBuilder.buildCell(field, data), ); cells.add(cell); - }); + } return cells; } } diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/widgets/grid_header/header.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/widgets/grid_header/header.dart index e69de29bb2..51bceb239a 100644 --- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/widgets/grid_header/header.dart +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/widgets/grid_header/header.dart @@ -0,0 +1,60 @@ +import 'package:app_flowy/workspace/presentation/plugins/grid/grid_sizes.dart'; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart'; +import 'package:flutter/material.dart'; + +import 'header_cell.dart'; + +class GridHeaderDelegate extends SliverPersistentHeaderDelegate { + final List fields; + + GridHeaderDelegate(this.fields); + + @override + Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) { + return GridHeader(fields: fields); + } + + @override + double get maxExtent => GridSize.headerHeight; + + @override + double get minExtent => GridSize.headerHeight; + + @override + bool shouldRebuild(covariant SliverPersistentHeaderDelegate oldDelegate) { + if (oldDelegate is GridHeaderDelegate) { + return fields != oldDelegate.fields; + } + return false; + } +} + +class GridHeader extends StatelessWidget { + final List fields; + + const GridHeader({required this.fields, Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + final headers = List.empty(growable: true); + fields.asMap().forEach((index, field) { + final header = HeaderCellContainer( + width: field.width.toDouble(), + child: HeaderCell( + field, + ), + ); + + // + headers.add(header); + }); + + return Row( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + const HeaderCellLeading(), + ...headers, + ], + ); + } +} diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/widgets/grid_header/header_cell.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/widgets/grid_header/header_cell.dart index eda546416d..8fbe34fa2b 100755 --- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/widgets/grid_header/header_cell.dart +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/widgets/grid_header/header_cell.dart @@ -1,5 +1,5 @@ import 'package:app_flowy/workspace/presentation/plugins/grid/grid_sizes.dart'; -import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart' hide Row; +import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart'; import 'package:flutter/material.dart'; import 'constants.dart'; 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 1c6420c126..21e2804539 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 @@ -35,3 +35,54 @@ class GridEventOpenGrid { } } +class GridEventGetRows { + RepeatedRowOrder request; + GridEventGetRows(this.request); + + Future> send() { + final request = FFIRequest.create() + ..event = GridEvent.GetRows.toString() + ..payload = requestToBytes(this.request); + + return Dispatch.asyncRequest(request) + .then((bytesResult) => bytesResult.fold( + (okBytes) => left(RepeatedRow.fromBuffer(okBytes)), + (errBytes) => right(FlowyError.fromBuffer(errBytes)), + )); + } +} + +class GridEventGetFields { + RepeatedFieldOrder request; + GridEventGetFields(this.request); + + Future> send() { + final request = FFIRequest.create() + ..event = GridEvent.GetFields.toString() + ..payload = requestToBytes(this.request); + + return Dispatch.asyncRequest(request) + .then((bytesResult) => bytesResult.fold( + (okBytes) => left(RepeatedField.fromBuffer(okBytes)), + (errBytes) => right(FlowyError.fromBuffer(errBytes)), + )); + } +} + +class GridEventCreateRow { + GridId request; + GridEventCreateRow(this.request); + + Future> send() { + final request = FFIRequest.create() + ..event = GridEvent.CreateRow.toString() + ..payload = requestToBytes(this.request); + + return Dispatch.asyncRequest(request) + .then((bytesResult) => bytesResult.fold( + (bytes) => left(unit), + (errBytes) => right(FlowyError.fromBuffer(errBytes)), + )); + } +} + diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid.pb.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid.pb.dart index 64e47d37d1..2d8aeace2c 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid.pb.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid.pb.dart @@ -229,7 +229,6 @@ class FieldOrder extends $pb.GeneratedMessage { static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'FieldOrder', createEmptyInstance: create) ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldId') ..aOB(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'visibility') - ..a<$core.int>(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'width', $pb.PbFieldType.O3) ..hasRequiredFields = false ; @@ -237,7 +236,6 @@ class FieldOrder extends $pb.GeneratedMessage { factory FieldOrder({ $core.String? fieldId, $core.bool? visibility, - $core.int? width, }) { final _result = create(); if (fieldId != null) { @@ -246,9 +244,6 @@ class FieldOrder extends $pb.GeneratedMessage { if (visibility != null) { _result.visibility = visibility; } - if (width != null) { - _result.width = width; - } return _result; } factory FieldOrder.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); @@ -289,15 +284,6 @@ class FieldOrder extends $pb.GeneratedMessage { $core.bool hasVisibility() => $_has(1); @$pb.TagNumber(2) void clearVisibility() => clearField(2); - - @$pb.TagNumber(3) - $core.int get width => $_getIZ(2); - @$pb.TagNumber(3) - set width($core.int v) { $_setSignedInt32(2, v); } - @$pb.TagNumber(3) - $core.bool hasWidth() => $_has(2); - @$pb.TagNumber(3) - void clearWidth() => clearField(3); } class RepeatedFieldOrder extends $pb.GeneratedMessage { @@ -348,7 +334,8 @@ class Field extends $pb.GeneratedMessage { ..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'desc') ..e(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldType', $pb.PbFieldType.OE, defaultOrMaker: FieldType.RichText, valueOf: FieldType.valueOf, enumValues: FieldType.values) ..aOB(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'frozen') - ..aOM(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'typeOptions', subBuilder: AnyData.create) + ..a<$core.int>(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'width', $pb.PbFieldType.O3) + ..aOM(7, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'typeOptions', subBuilder: AnyData.create) ..hasRequiredFields = false ; @@ -359,6 +346,7 @@ class Field extends $pb.GeneratedMessage { $core.String? desc, FieldType? fieldType, $core.bool? frozen, + $core.int? width, AnyData? typeOptions, }) { final _result = create(); @@ -377,6 +365,9 @@ class Field extends $pb.GeneratedMessage { if (frozen != null) { _result.frozen = frozen; } + if (width != null) { + _result.width = width; + } if (typeOptions != null) { _result.typeOptions = typeOptions; } @@ -449,32 +440,82 @@ class Field extends $pb.GeneratedMessage { void clearFrozen() => clearField(5); @$pb.TagNumber(6) - AnyData get typeOptions => $_getN(5); + $core.int get width => $_getIZ(5); @$pb.TagNumber(6) - set typeOptions(AnyData v) { setField(6, v); } + set width($core.int v) { $_setSignedInt32(5, v); } @$pb.TagNumber(6) - $core.bool hasTypeOptions() => $_has(5); + $core.bool hasWidth() => $_has(5); @$pb.TagNumber(6) - void clearTypeOptions() => clearField(6); - @$pb.TagNumber(6) - AnyData ensureTypeOptions() => $_ensure(5); + void clearWidth() => clearField(6); + + @$pb.TagNumber(7) + AnyData get typeOptions => $_getN(6); + @$pb.TagNumber(7) + set typeOptions(AnyData v) { setField(7, v); } + @$pb.TagNumber(7) + $core.bool hasTypeOptions() => $_has(6); + @$pb.TagNumber(7) + void clearTypeOptions() => clearField(7); + @$pb.TagNumber(7) + AnyData ensureTypeOptions() => $_ensure(6); +} + +class RepeatedField extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'RepeatedField', createEmptyInstance: create) + ..pc(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'items', $pb.PbFieldType.PM, subBuilder: Field.create) + ..hasRequiredFields = false + ; + + RepeatedField._() : super(); + factory RepeatedField({ + $core.Iterable? items, + }) { + final _result = create(); + if (items != null) { + _result.items.addAll(items); + } + return _result; + } + factory RepeatedField.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory RepeatedField.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') + RepeatedField clone() => RepeatedField()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + RepeatedField copyWith(void Function(RepeatedField) updates) => super.copyWith((message) => updates(message as RepeatedField)) as RepeatedField; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static RepeatedField create() => RepeatedField._(); + RepeatedField createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static RepeatedField getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static RepeatedField? _defaultInstance; + + @$pb.TagNumber(1) + $core.List get items => $_getList(0); } class AnyData extends $pb.GeneratedMessage { static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'AnyData', createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'typeUrl') + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'typeId') ..a<$core.List<$core.int>>(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'value', $pb.PbFieldType.OY) ..hasRequiredFields = false ; AnyData._() : super(); factory AnyData({ - $core.String? typeUrl, + $core.String? typeId, $core.List<$core.int>? value, }) { final _result = create(); - if (typeUrl != null) { - _result.typeUrl = typeUrl; + if (typeId != null) { + _result.typeId = typeId; } if (value != null) { _result.value = value; @@ -503,13 +544,13 @@ class AnyData extends $pb.GeneratedMessage { static AnyData? _defaultInstance; @$pb.TagNumber(1) - $core.String get typeUrl => $_getSZ(0); + $core.String get typeId => $_getSZ(0); @$pb.TagNumber(1) - set typeUrl($core.String v) { $_setString(0, v); } + set typeId($core.String v) { $_setString(0, v); } @$pb.TagNumber(1) - $core.bool hasTypeUrl() => $_has(0); + $core.bool hasTypeId() => $_has(0); @$pb.TagNumber(1) - void clearTypeUrl() => clearField(1); + void clearTypeId() => clearField(1); @$pb.TagNumber(2) $core.List<$core.int> get value => $_getN(1); @@ -637,21 +678,21 @@ class RepeatedRowOrder extends $pb.GeneratedMessage { $core.List get items => $_getList(0); } -class Row extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'Row', createEmptyInstance: create) +class GridRow extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'GridRow', createEmptyInstance: create) ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'id') ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridId') ..aInt64(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'modifiedTime') - ..m<$core.String, Cell>(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'cellByFieldId', entryClassName: 'Row.CellByFieldIdEntry', keyFieldType: $pb.PbFieldType.OS, valueFieldType: $pb.PbFieldType.OM, valueCreator: Cell.create) + ..m<$core.String, GridCell>(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'cellByFieldId', entryClassName: 'GridRow.CellByFieldIdEntry', keyFieldType: $pb.PbFieldType.OS, valueFieldType: $pb.PbFieldType.OM, valueCreator: GridCell.create) ..hasRequiredFields = false ; - Row._() : super(); - factory Row({ + GridRow._() : super(); + factory GridRow({ $core.String? id, $core.String? gridId, $fixnum.Int64? modifiedTime, - $core.Map<$core.String, Cell>? cellByFieldId, + $core.Map<$core.String, GridCell>? cellByFieldId, }) { final _result = create(); if (id != null) { @@ -668,26 +709,26 @@ class Row extends $pb.GeneratedMessage { } return _result; } - factory Row.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory Row.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + factory GridRow.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GridRow.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') - Row clone() => Row()..mergeFromMessage(this); + GridRow clone() => GridRow()..mergeFromMessage(this); @$core.Deprecated( 'Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' 'Will be removed in next major version') - Row copyWith(void Function(Row) updates) => super.copyWith((message) => updates(message as Row)) as Row; // ignore: deprecated_member_use + GridRow copyWith(void Function(GridRow) updates) => super.copyWith((message) => updates(message as GridRow)) as GridRow; // ignore: deprecated_member_use $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') - static Row create() => Row._(); - Row createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static GridRow create() => GridRow._(); + GridRow createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') - static Row getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static Row? _defaultInstance; + static GridRow getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GridRow? _defaultInstance; @$pb.TagNumber(1) $core.String get id => $_getSZ(0); @@ -717,22 +758,65 @@ class Row extends $pb.GeneratedMessage { void clearModifiedTime() => clearField(3); @$pb.TagNumber(4) - $core.Map<$core.String, Cell> get cellByFieldId => $_getMap(3); + $core.Map<$core.String, GridCell> get cellByFieldId => $_getMap(3); } -class Cell extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'Cell', createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'id') - ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'rowId') - ..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldId') +class RepeatedRow extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'RepeatedRow', createEmptyInstance: create) + ..pc(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'items', $pb.PbFieldType.PM, subBuilder: GridRow.create) ..hasRequiredFields = false ; - Cell._() : super(); - factory Cell({ + RepeatedRow._() : super(); + factory RepeatedRow({ + $core.Iterable? items, + }) { + final _result = create(); + if (items != null) { + _result.items.addAll(items); + } + return _result; + } + factory RepeatedRow.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory RepeatedRow.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') + RepeatedRow clone() => RepeatedRow()..mergeFromMessage(this); + @$core.Deprecated( + 'Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + RepeatedRow copyWith(void Function(RepeatedRow) updates) => super.copyWith((message) => updates(message as RepeatedRow)) as RepeatedRow; // ignore: deprecated_member_use + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static RepeatedRow create() => RepeatedRow._(); + RepeatedRow createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + @$core.pragma('dart2js:noInline') + static RepeatedRow getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static RepeatedRow? _defaultInstance; + + @$pb.TagNumber(1) + $core.List get items => $_getList(0); +} + +class GridCell extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'GridCell', createEmptyInstance: create) + ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'id') + ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'rowId') + ..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldId') + ..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'content') + ..hasRequiredFields = false + ; + + GridCell._() : super(); + factory GridCell({ $core.String? id, $core.String? rowId, $core.String? fieldId, + $core.String? content, }) { final _result = create(); if (id != null) { @@ -744,28 +828,31 @@ class Cell extends $pb.GeneratedMessage { if (fieldId != null) { _result.fieldId = fieldId; } + if (content != null) { + _result.content = content; + } return _result; } - factory Cell.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory Cell.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + factory GridCell.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory GridCell.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') - Cell clone() => Cell()..mergeFromMessage(this); + GridCell clone() => GridCell()..mergeFromMessage(this); @$core.Deprecated( 'Using this can add significant overhead to your binary. ' 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' 'Will be removed in next major version') - Cell copyWith(void Function(Cell) updates) => super.copyWith((message) => updates(message as Cell)) as Cell; // ignore: deprecated_member_use + GridCell copyWith(void Function(GridCell) updates) => super.copyWith((message) => updates(message as GridCell)) as GridCell; // ignore: deprecated_member_use $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') - static Cell create() => Cell._(); - Cell createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static GridCell create() => GridCell._(); + GridCell createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') - static Cell getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static Cell? _defaultInstance; + static GridCell getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static GridCell? _defaultInstance; @$pb.TagNumber(1) $core.String get id => $_getSZ(0); @@ -793,130 +880,15 @@ class Cell extends $pb.GeneratedMessage { $core.bool hasFieldId() => $_has(2); @$pb.TagNumber(3) void clearFieldId() => clearField(3); -} -class DisplayCell extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'DisplayCell', createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'id') - ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'content') - ..hasRequiredFields = false - ; - - DisplayCell._() : super(); - factory DisplayCell({ - $core.String? id, - $core.String? content, - }) { - final _result = create(); - if (id != null) { - _result.id = id; - } - if (content != null) { - _result.content = content; - } - return _result; - } - factory DisplayCell.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory DisplayCell.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') - DisplayCell clone() => DisplayCell()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - DisplayCell copyWith(void Function(DisplayCell) updates) => super.copyWith((message) => updates(message as DisplayCell)) as DisplayCell; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static DisplayCell create() => DisplayCell._(); - DisplayCell createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static DisplayCell getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static DisplayCell? _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 content => $_getSZ(1); - @$pb.TagNumber(2) - set content($core.String v) { $_setString(1, v); } - @$pb.TagNumber(2) - $core.bool hasContent() => $_has(1); - @$pb.TagNumber(2) - void clearContent() => clearField(2); -} - -class RawCell extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'RawCell', createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'id') - ..aOM(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'data', subBuilder: AnyData.create) - ..hasRequiredFields = false - ; - - RawCell._() : super(); - factory RawCell({ - $core.String? id, - AnyData? data, - }) { - final _result = create(); - if (id != null) { - _result.id = id; - } - if (data != null) { - _result.data = data; - } - return _result; - } - factory RawCell.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory RawCell.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') - RawCell clone() => RawCell()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - RawCell copyWith(void Function(RawCell) updates) => super.copyWith((message) => updates(message as RawCell)) as RawCell; // ignore: deprecated_member_use - $pb.BuilderInfo get info_ => _i; - @$core.pragma('dart2js:noInline') - static RawCell create() => RawCell._(); - RawCell createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static RawCell getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static RawCell? _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) - AnyData get data => $_getN(1); - @$pb.TagNumber(2) - set data(AnyData v) { setField(2, v); } - @$pb.TagNumber(2) - $core.bool hasData() => $_has(1); - @$pb.TagNumber(2) - void clearData() => clearField(2); - @$pb.TagNumber(2) - AnyData ensureData() => $_ensure(1); + @$pb.TagNumber(4) + $core.String get content => $_getSZ(3); + @$pb.TagNumber(4) + set content($core.String v) { $_setString(3, v); } + @$pb.TagNumber(4) + $core.bool hasContent() => $_has(3); + @$pb.TagNumber(4) + void clearContent() => clearField(4); } class CreateGridPayload extends $pb.GeneratedMessage { diff --git a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid.pbjson.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid.pbjson.dart index 93e221828a..bfbd6266da 100644 --- a/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid.pbjson.dart +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid-data-model/grid.pbjson.dart @@ -64,12 +64,11 @@ const FieldOrder$json = const { '2': const [ const {'1': 'field_id', '3': 1, '4': 1, '5': 9, '10': 'fieldId'}, const {'1': 'visibility', '3': 2, '4': 1, '5': 8, '10': 'visibility'}, - const {'1': 'width', '3': 3, '4': 1, '5': 5, '10': 'width'}, ], }; /// Descriptor for `FieldOrder`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List fieldOrderDescriptor = $convert.base64Decode('CgpGaWVsZE9yZGVyEhkKCGZpZWxkX2lkGAEgASgJUgdmaWVsZElkEh4KCnZpc2liaWxpdHkYAiABKAhSCnZpc2liaWxpdHkSFAoFd2lkdGgYAyABKAVSBXdpZHRo'); +final $typed_data.Uint8List fieldOrderDescriptor = $convert.base64Decode('CgpGaWVsZE9yZGVyEhkKCGZpZWxkX2lkGAEgASgJUgdmaWVsZElkEh4KCnZpc2liaWxpdHkYAiABKAhSCnZpc2liaWxpdHk='); @$core.Deprecated('Use repeatedFieldOrderDescriptor instead') const RepeatedFieldOrder$json = const { '1': 'RepeatedFieldOrder', @@ -89,23 +88,34 @@ const Field$json = const { const {'1': 'desc', '3': 3, '4': 1, '5': 9, '10': 'desc'}, const {'1': 'field_type', '3': 4, '4': 1, '5': 14, '6': '.FieldType', '10': 'fieldType'}, const {'1': 'frozen', '3': 5, '4': 1, '5': 8, '10': 'frozen'}, - const {'1': 'type_options', '3': 6, '4': 1, '5': 11, '6': '.AnyData', '10': 'typeOptions'}, + const {'1': 'width', '3': 6, '4': 1, '5': 5, '10': 'width'}, + const {'1': 'type_options', '3': 7, '4': 1, '5': 11, '6': '.AnyData', '10': 'typeOptions'}, ], }; /// Descriptor for `Field`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List fieldDescriptor = $convert.base64Decode('CgVGaWVsZBIOCgJpZBgBIAEoCVICaWQSEgoEbmFtZRgCIAEoCVIEbmFtZRISCgRkZXNjGAMgASgJUgRkZXNjEikKCmZpZWxkX3R5cGUYBCABKA4yCi5GaWVsZFR5cGVSCWZpZWxkVHlwZRIWCgZmcm96ZW4YBSABKAhSBmZyb3plbhIrCgx0eXBlX29wdGlvbnMYBiABKAsyCC5BbnlEYXRhUgt0eXBlT3B0aW9ucw=='); +final $typed_data.Uint8List fieldDescriptor = $convert.base64Decode('CgVGaWVsZBIOCgJpZBgBIAEoCVICaWQSEgoEbmFtZRgCIAEoCVIEbmFtZRISCgRkZXNjGAMgASgJUgRkZXNjEikKCmZpZWxkX3R5cGUYBCABKA4yCi5GaWVsZFR5cGVSCWZpZWxkVHlwZRIWCgZmcm96ZW4YBSABKAhSBmZyb3plbhIUCgV3aWR0aBgGIAEoBVIFd2lkdGgSKwoMdHlwZV9vcHRpb25zGAcgASgLMgguQW55RGF0YVILdHlwZU9wdGlvbnM='); +@$core.Deprecated('Use repeatedFieldDescriptor instead') +const RepeatedField$json = const { + '1': 'RepeatedField', + '2': const [ + const {'1': 'items', '3': 1, '4': 3, '5': 11, '6': '.Field', '10': 'items'}, + ], +}; + +/// Descriptor for `RepeatedField`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List repeatedFieldDescriptor = $convert.base64Decode('Cg1SZXBlYXRlZEZpZWxkEhwKBWl0ZW1zGAEgAygLMgYuRmllbGRSBWl0ZW1z'); @$core.Deprecated('Use anyDataDescriptor instead') const AnyData$json = const { '1': 'AnyData', '2': const [ - const {'1': 'type_url', '3': 1, '4': 1, '5': 9, '10': 'typeUrl'}, + const {'1': 'type_id', '3': 1, '4': 1, '5': 9, '10': 'typeId'}, const {'1': 'value', '3': 2, '4': 1, '5': 12, '10': 'value'}, ], }; /// Descriptor for `AnyData`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List anyDataDescriptor = $convert.base64Decode('CgdBbnlEYXRhEhkKCHR5cGVfdXJsGAEgASgJUgd0eXBlVXJsEhQKBXZhbHVlGAIgASgMUgV2YWx1ZQ=='); +final $typed_data.Uint8List anyDataDescriptor = $convert.base64Decode('CgdBbnlEYXRhEhcKB3R5cGVfaWQYASABKAlSBnR5cGVJZBIUCgV2YWx1ZRgCIAEoDFIFdmFsdWU='); @$core.Deprecated('Use rowOrderDescriptor instead') const RowOrder$json = const { '1': 'RowOrder', @@ -128,64 +138,53 @@ const RepeatedRowOrder$json = const { /// Descriptor for `RepeatedRowOrder`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List repeatedRowOrderDescriptor = $convert.base64Decode('ChBSZXBlYXRlZFJvd09yZGVyEh8KBWl0ZW1zGAEgAygLMgkuUm93T3JkZXJSBWl0ZW1z'); -@$core.Deprecated('Use rowDescriptor instead') -const Row$json = const { - '1': 'Row', +@$core.Deprecated('Use gridRowDescriptor instead') +const GridRow$json = const { + '1': 'GridRow', '2': const [ const {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'}, const {'1': 'grid_id', '3': 2, '4': 1, '5': 9, '10': 'gridId'}, const {'1': 'modified_time', '3': 3, '4': 1, '5': 3, '10': 'modifiedTime'}, - const {'1': 'cell_by_field_id', '3': 4, '4': 3, '5': 11, '6': '.Row.CellByFieldIdEntry', '10': 'cellByFieldId'}, + const {'1': 'cell_by_field_id', '3': 4, '4': 3, '5': 11, '6': '.GridRow.CellByFieldIdEntry', '10': 'cellByFieldId'}, ], - '3': const [Row_CellByFieldIdEntry$json], + '3': const [GridRow_CellByFieldIdEntry$json], }; -@$core.Deprecated('Use rowDescriptor instead') -const Row_CellByFieldIdEntry$json = const { +@$core.Deprecated('Use gridRowDescriptor instead') +const GridRow_CellByFieldIdEntry$json = const { '1': 'CellByFieldIdEntry', '2': const [ const {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'}, - const {'1': 'value', '3': 2, '4': 1, '5': 11, '6': '.Cell', '10': 'value'}, + const {'1': 'value', '3': 2, '4': 1, '5': 11, '6': '.GridCell', '10': 'value'}, ], '7': const {'7': true}, }; -/// Descriptor for `Row`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List rowDescriptor = $convert.base64Decode('CgNSb3cSDgoCaWQYASABKAlSAmlkEhcKB2dyaWRfaWQYAiABKAlSBmdyaWRJZBIjCg1tb2RpZmllZF90aW1lGAMgASgDUgxtb2RpZmllZFRpbWUSQAoQY2VsbF9ieV9maWVsZF9pZBgEIAMoCzIXLlJvdy5DZWxsQnlGaWVsZElkRW50cnlSDWNlbGxCeUZpZWxkSWQaRwoSQ2VsbEJ5RmllbGRJZEVudHJ5EhAKA2tleRgBIAEoCVIDa2V5EhsKBXZhbHVlGAIgASgLMgUuQ2VsbFIFdmFsdWU6AjgB'); -@$core.Deprecated('Use cellDescriptor instead') -const Cell$json = const { - '1': 'Cell', +/// Descriptor for `GridRow`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List gridRowDescriptor = $convert.base64Decode('CgdHcmlkUm93Eg4KAmlkGAEgASgJUgJpZBIXCgdncmlkX2lkGAIgASgJUgZncmlkSWQSIwoNbW9kaWZpZWRfdGltZRgDIAEoA1IMbW9kaWZpZWRUaW1lEkQKEGNlbGxfYnlfZmllbGRfaWQYBCADKAsyGy5HcmlkUm93LkNlbGxCeUZpZWxkSWRFbnRyeVINY2VsbEJ5RmllbGRJZBpLChJDZWxsQnlGaWVsZElkRW50cnkSEAoDa2V5GAEgASgJUgNrZXkSHwoFdmFsdWUYAiABKAsyCS5HcmlkQ2VsbFIFdmFsdWU6AjgB'); +@$core.Deprecated('Use repeatedRowDescriptor instead') +const RepeatedRow$json = const { + '1': 'RepeatedRow', + '2': const [ + const {'1': 'items', '3': 1, '4': 3, '5': 11, '6': '.GridRow', '10': 'items'}, + ], +}; + +/// Descriptor for `RepeatedRow`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List repeatedRowDescriptor = $convert.base64Decode('CgtSZXBlYXRlZFJvdxIeCgVpdGVtcxgBIAMoCzIILkdyaWRSb3dSBWl0ZW1z'); +@$core.Deprecated('Use gridCellDescriptor instead') +const GridCell$json = const { + '1': 'GridCell', '2': const [ const {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'}, const {'1': 'row_id', '3': 2, '4': 1, '5': 9, '10': 'rowId'}, const {'1': 'field_id', '3': 3, '4': 1, '5': 9, '10': 'fieldId'}, + const {'1': 'content', '3': 4, '4': 1, '5': 9, '10': 'content'}, ], }; -/// Descriptor for `Cell`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List cellDescriptor = $convert.base64Decode('CgRDZWxsEg4KAmlkGAEgASgJUgJpZBIVCgZyb3dfaWQYAiABKAlSBXJvd0lkEhkKCGZpZWxkX2lkGAMgASgJUgdmaWVsZElk'); -@$core.Deprecated('Use displayCellDescriptor instead') -const DisplayCell$json = const { - '1': 'DisplayCell', - '2': const [ - const {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'}, - const {'1': 'content', '3': 2, '4': 1, '5': 9, '10': 'content'}, - ], -}; - -/// Descriptor for `DisplayCell`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List displayCellDescriptor = $convert.base64Decode('CgtEaXNwbGF5Q2VsbBIOCgJpZBgBIAEoCVICaWQSGAoHY29udGVudBgCIAEoCVIHY29udGVudA=='); -@$core.Deprecated('Use rawCellDescriptor instead') -const RawCell$json = const { - '1': 'RawCell', - '2': const [ - const {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'}, - const {'1': 'data', '3': 2, '4': 1, '5': 11, '6': '.AnyData', '10': 'data'}, - ], -}; - -/// Descriptor for `RawCell`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List rawCellDescriptor = $convert.base64Decode('CgdSYXdDZWxsEg4KAmlkGAEgASgJUgJpZBIcCgRkYXRhGAIgASgLMgguQW55RGF0YVIEZGF0YQ=='); +/// Descriptor for `GridCell`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List gridCellDescriptor = $convert.base64Decode('CghHcmlkQ2VsbBIOCgJpZBgBIAEoCVICaWQSFQoGcm93X2lkGAIgASgJUgVyb3dJZBIZCghmaWVsZF9pZBgDIAEoCVIHZmllbGRJZBIYCgdjb250ZW50GAQgASgJUgdjb250ZW50'); @$core.Deprecated('Use createGridPayloadDescriptor instead') const CreateGridPayload$json = const { '1': 'CreateGridPayload', 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 new file mode 100644 index 0000000000..d87c9e02c7 --- /dev/null +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/cell_data.pb.dart @@ -0,0 +1,458 @@ +/// +// 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 new file mode 100644 index 0000000000..b6512aafba --- /dev/null +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/cell_data.pbenum.dart @@ -0,0 +1,62 @@ +/// +// 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 new file mode 100644 index 0000000000..c2caf59394 --- /dev/null +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/cell_data.pbjson.dart @@ -0,0 +1,125 @@ +/// +// 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/cell_data.pbserver.dart b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/cell_data.pbserver.dart new file mode 100644 index 0000000000..bae86fb5d9 --- /dev/null +++ b/frontend/app_flowy/packages/flowy_sdk/lib/protobuf/flowy-grid/cell_data.pbserver.dart @@ -0,0 +1,9 @@ +/// +// 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 + +export 'cell_data.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 c8b9528369..2b523834c3 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 @@ -12,10 +12,16 @@ import 'package:protobuf/protobuf.dart' as $pb; class GridEvent extends $pb.ProtobufEnum { static const GridEvent CreateGrid = GridEvent._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'CreateGrid'); static const GridEvent OpenGrid = GridEvent._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'OpenGrid'); + static const GridEvent GetRows = GridEvent._(2, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'GetRows'); + static const GridEvent GetFields = GridEvent._(3, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'GetFields'); + static const GridEvent CreateRow = GridEvent._(4, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'CreateRow'); static const $core.List values = [ CreateGrid, OpenGrid, + GetRows, + GetFields, + CreateRow, ]; static final $core.Map<$core.int, GridEvent> _byValue = $pb.ProtobufEnum.initByValue(values); 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 1b16f0b657..19412ddc1d 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 @@ -14,8 +14,11 @@ const GridEvent$json = const { '2': const [ const {'1': 'CreateGrid', '2': 0}, const {'1': 'OpenGrid', '2': 1}, + const {'1': 'GetRows', '2': 2}, + const {'1': 'GetFields', '2': 3}, + const {'1': 'CreateRow', '2': 4}, ], }; /// Descriptor for `GridEvent`. Decode as a `google.protobuf.EnumDescriptorProto`. -final $typed_data.Uint8List gridEventDescriptor = $convert.base64Decode('CglHcmlkRXZlbnQSDgoKQ3JlYXRlR3JpZBAAEgwKCE9wZW5HcmlkEAE='); +final $typed_data.Uint8List gridEventDescriptor = $convert.base64Decode('CglHcmlkRXZlbnQSDgoKQ3JlYXRlR3JpZBAAEgwKCE9wZW5HcmlkEAESCwoHR2V0Um93cxACEg0KCUdldEZpZWxkcxADEg0KCUNyZWF0ZVJvdxAE'); 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 a5735f1a1a..39a722893a 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,2 +1,3 @@ // Auto-generated, do not edit +export './cell_data.pb.dart'; export './event_map.pb.dart'; diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lock index dec40ba22d..05d59f7879 100755 --- a/frontend/rust-lib/Cargo.lock +++ b/frontend/rust-lib/Cargo.lock @@ -57,6 +57,12 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" +[[package]] +name = "arrayvec" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" + [[package]] name = "async-stream" version = "0.3.2" @@ -1042,15 +1048,21 @@ dependencies = [ name = "flowy-grid" version = "0.1.0" dependencies = [ + "bytes", + "chrono", "flowy-derive", "flowy-error", "flowy-grid-data-model", + "lazy_static", "lib-dispatch", "lib-infra", "protobuf", + "rust_decimal", + "rusty-money", "strum", "strum_macros", "tracing", + "uuid", ] [[package]] @@ -1061,6 +1073,8 @@ dependencies = [ "flowy-derive", "lib-infra", "protobuf", + "strum", + "strum_macros", ] [[package]] @@ -1702,7 +1716,7 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe" dependencies = [ - "arrayvec", + "arrayvec 0.5.2", "bitflags", "cfg-if", "ryu", @@ -2752,6 +2766,27 @@ dependencies = [ "winreg", ] +[[package]] +name = "rust_decimal" +version = "1.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d37baa70cf8662d2ba1c1868c5983dda16ef32b105cce41fb5c47e72936a90b3" +dependencies = [ + "arrayvec 0.7.2", + "num-traits", + "serde", +] + +[[package]] +name = "rust_decimal_macros" +version = "1.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "184abaf7b434800e1a5a8aad3ebc8cd7498df33af72d65371d797a264713a59b" +dependencies = [ + "quote", + "rust_decimal", +] + [[package]] name = "rustc-demangle" version = "0.1.21" @@ -2773,6 +2808,16 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f" +[[package]] +name = "rusty-money" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b28f881005eac7ad8d46b6f075da5f322bd7f4f83a38720fc069694ddadd683" +dependencies = [ + "rust_decimal", + "rust_decimal_macros", +] + [[package]] name = "ryu" version = "1.0.9" diff --git a/frontend/rust-lib/flowy-grid/Cargo.toml b/frontend/rust-lib/flowy-grid/Cargo.toml index b2d58b7794..31030c5d28 100644 --- a/frontend/rust-lib/flowy-grid/Cargo.toml +++ b/frontend/rust-lib/flowy-grid/Cargo.toml @@ -15,6 +15,12 @@ strum_macros = "0.21" flowy-derive = { path = "../../../shared-lib/flowy-derive" } tracing = { version = "0.1", features = ["log"] } protobuf = {version = "2.18.0"} +rust_decimal = "1.8.1" +rusty-money = {version = "0.4.0", features = ["iso"]} +lazy_static = "1.4.0" +chrono = "0.4.19" +uuid = { version = "0.8", features = ["serde", "v4"] } +bytes = { version = "1.0" } [build-dependencies] lib-infra = { path = "../../../shared-lib/lib-infra", features = ["protobuf_file_gen", "proto_gen"] } diff --git a/frontend/rust-lib/flowy-grid/Flowy.toml b/frontend/rust-lib/flowy-grid/Flowy.toml index 934d557323..1f99bcf43d 100644 --- a/frontend/rust-lib/flowy-grid/Flowy.toml +++ b/frontend/rust-lib/flowy-grid/Flowy.toml @@ -1,3 +1,3 @@ -proto_crates = ["src/event_map.rs"] +proto_crates = ["src/event_map.rs", "src/cell_service/cell_data.rs"] event_files = ["src/event_map.rs"] \ No newline at end of file diff --git a/frontend/rust-lib/flowy-grid/src/cell_service/cell_data.rs b/frontend/rust-lib/flowy-grid/src/cell_service/cell_data.rs new file mode 100644 index 0000000000..fdd62b796c --- /dev/null +++ b/frontend/rust-lib/flowy-grid/src/cell_service/cell_data.rs @@ -0,0 +1,469 @@ +use crate::cell_service::util::*; +use crate::impl_any_data; +use bytes::Bytes; +use chrono::format::strftime::StrftimeItems; +use chrono::NaiveDateTime; +use flowy_derive::{ProtoBuf, ProtoBuf_Enum}; +use flowy_error::FlowyError; +use flowy_grid_data_model::entities::{AnyData, Field, FieldType}; +use rust_decimal::Decimal; +use rusty_money::{ + iso::{Currency, CNY, EUR, USD}, + Money, +}; +use std::str::FromStr; + +use strum::IntoEnumIterator; +use strum_macros::EnumIter; + +pub trait StringifyAnyData { + fn stringify_any_data(&self, data: &AnyData) -> String; + fn str_to_any_data(&self, s: &str) -> Result; +} + +pub trait DisplayCell { + fn display_content(&self, s: &str) -> String; +} + +#[derive(Debug, Clone, ProtoBuf, Default)] +pub struct RichTextDescription { + #[pb(index = 1)] + pub format: String, +} +impl_any_data!(RichTextDescription, FieldType::RichText); + +impl StringifyAnyData for RichTextDescription { + fn stringify_any_data(&self, data: &AnyData) -> String { + data.to_string() + } + + fn str_to_any_data(&self, s: &str) -> Result { + Ok(AnyData::from_str(&RichTextDescription::field_type(), s)) + } +} + +impl DisplayCell for RichTextDescription { + fn display_content(&self, s: &str) -> String { + s.to_string() + } +} + +// Checkbox +#[derive(Debug, ProtoBuf, Default)] +pub struct CheckboxDescription { + #[pb(index = 1)] + pub is_selected: bool, +} +impl_any_data!(CheckboxDescription, FieldType::Checkbox); + +impl StringifyAnyData for CheckboxDescription { + fn stringify_any_data(&self, data: &AnyData) -> String { + data.to_string() + } + + fn str_to_any_data(&self, s: &str) -> Result { + let s = match string_to_bool(s) { + true => "1", + false => "0", + }; + Ok(AnyData::from_str(&CheckboxDescription::field_type(), s)) + } +} + +impl DisplayCell for CheckboxDescription { + fn display_content(&self, s: &str) -> String { + s.to_string() + } +} + +// Date +#[derive(Clone, Debug, ProtoBuf)] +pub struct DateDescription { + #[pb(index = 1)] + pub date_format: DateFormat, + + #[pb(index = 2)] + pub time_format: TimeFormat, +} +impl_any_data!(DateDescription, FieldType::DateTime); + +impl std::default::Default for DateDescription { + fn default() -> Self { + DateDescription { + date_format: DateFormat::default(), + time_format: TimeFormat::default(), + } + } +} + +impl DateDescription { + fn date_time_format_str(&self) -> String { + format!("{} {}", self.date_format.format_str(), self.time_format.format_str()) + } + + #[allow(dead_code)] + fn today_from_timestamp(&self, timestamp: i64) -> String { + let native = chrono::NaiveDateTime::from_timestamp(timestamp, 0); + self.today_from_native(native) + } + + fn today_from_native(&self, naive: chrono::NaiveDateTime) -> String { + let utc: chrono::DateTime = chrono::DateTime::from_utc(naive, chrono::Utc); + let local: chrono::DateTime = chrono::DateTime::from(utc); + + let fmt_str = self.date_time_format_str(); + let output = format!("{}", local.format_with_items(StrftimeItems::new(&fmt_str))); + output + } +} + +impl DisplayCell for DateDescription { + fn display_content(&self, s: &str) -> String { + match s.parse::() { + Ok(timestamp) => { + let native = NaiveDateTime::from_timestamp(timestamp, 0); + self.today_from_native(native) + } + Err(e) => { + tracing::debug!("DateDescription format {} fail. error: {:?}", s, e); + String::new() + } + } + } +} + +impl StringifyAnyData for DateDescription { + fn stringify_any_data(&self, data: &AnyData) -> String { + match String::from_utf8(data.value.clone()) { + Ok(s) => match s.parse::() { + Ok(timestamp) => { + let native = NaiveDateTime::from_timestamp(timestamp, 0); + self.today_from_native(native) + } + Err(e) => { + tracing::debug!("DateDescription format {} fail. error: {:?}", s, e); + String::new() + } + }, + Err(e) => { + tracing::error!("DateDescription stringify any_data failed. {:?}", e); + String::new() + } + } + } + + fn str_to_any_data(&self, s: &str) -> Result { + let timestamp = s + .parse::() + .map_err(|e| FlowyError::internal().context(format!("Parse {} to i64 failed: {}", s, e)))?; + Ok(AnyData::from_str( + &DateDescription::field_type(), + &format!("{}", timestamp), + )) + } +} + +#[derive(Clone, Debug, Copy, ProtoBuf_Enum)] +pub enum DateFormat { + Local = 0, + US = 1, + ISO = 2, + Friendly = 3, +} +impl std::default::Default for DateFormat { + fn default() -> Self { + DateFormat::Friendly + } +} + +impl std::convert::From for DateFormat { + fn from(value: i32) -> Self { + match value { + 0 => DateFormat::Local, + 1 => DateFormat::US, + 2 => DateFormat::ISO, + 3 => DateFormat::Friendly, + _ => { + tracing::error!("Unsupported date format, fallback to friendly"); + DateFormat::Friendly + } + } + } +} + +impl DateFormat { + pub fn value(&self) -> i32 { + *self as i32 + } + // https://docs.rs/chrono/0.4.19/chrono/format/strftime/index.html + pub fn format_str(&self) -> &'static str { + match self { + DateFormat::Local => "%Y/%m/%d", + DateFormat::US => "%Y/%m/%d", + DateFormat::ISO => "%Y-%m-%d", + DateFormat::Friendly => "%b %d,%Y", + } + } +} + +#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash, ProtoBuf_Enum)] +pub enum TimeFormat { + TwelveHour = 0, + TwentyFourHour = 1, +} + +impl std::convert::From for TimeFormat { + fn from(value: i32) -> Self { + match value { + 0 => TimeFormat::TwelveHour, + 1 => TimeFormat::TwentyFourHour, + _ => { + tracing::error!("Unsupported time format, fallback to TwentyFourHour"); + TimeFormat::TwentyFourHour + } + } + } +} + +impl TimeFormat { + pub fn value(&self) -> i32 { + *self as i32 + } + + // https://docs.rs/chrono/0.4.19/chrono/format/strftime/index.html + pub fn format_str(&self) -> &'static str { + match self { + TimeFormat::TwelveHour => "%r", + TimeFormat::TwentyFourHour => "%R", + } + } +} + +impl std::default::Default for TimeFormat { + fn default() -> Self { + TimeFormat::TwentyFourHour + } +} + +// Single select +#[derive(Clone, Debug, ProtoBuf, Default)] +pub struct SingleSelect { + #[pb(index = 1)] + pub options: Vec, + + #[pb(index = 2)] + pub disable_color: bool, +} +impl_any_data!(SingleSelect, FieldType::SingleSelect); + +impl StringifyAnyData for SingleSelect { + fn stringify_any_data(&self, data: &AnyData) -> String { + data.to_string() + } + + fn str_to_any_data(&self, s: &str) -> Result { + Ok(AnyData::from_str(&SingleSelect::field_type(), s)) + } +} + +impl DisplayCell for SingleSelect { + fn display_content(&self, s: &str) -> String { + s.to_string() + } +} + +// Multiple select +#[derive(Clone, Debug, ProtoBuf, Default)] +pub struct MultiSelect { + #[pb(index = 1)] + pub options: Vec, + + #[pb(index = 2)] + pub disable_color: bool, +} +impl_any_data!(MultiSelect, FieldType::MultiSelect); +impl StringifyAnyData for MultiSelect { + fn stringify_any_data(&self, data: &AnyData) -> String { + data.to_string() + } + + fn str_to_any_data(&self, s: &str) -> Result { + Ok(AnyData::from_str(&MultiSelect::field_type(), s)) + } +} + +impl DisplayCell for MultiSelect { + fn display_content(&self, s: &str) -> String { + s.to_string() + } +} + +#[derive(Clone, Debug, ProtoBuf, Default)] +pub struct SelectOption { + #[pb(index = 1)] + pub id: String, + + #[pb(index = 2)] + pub name: String, + + #[pb(index = 3)] + pub color: String, +} + +impl SelectOption { + pub fn new(name: &str) -> Self { + SelectOption { + id: uuid(), + name: name.to_owned(), + color: "".to_string(), + } + } +} + +// Number +#[derive(Clone, Debug, ProtoBuf)] +pub struct NumberDescription { + #[pb(index = 1)] + pub money: FlowyMoney, + + #[pb(index = 2)] + pub scale: u32, + + #[pb(index = 3)] + pub symbol: String, + + #[pb(index = 4)] + pub sign_positive: bool, + + #[pb(index = 5)] + pub name: String, +} +impl_any_data!(NumberDescription, FieldType::Number); + +impl std::default::Default for NumberDescription { + fn default() -> Self { + NumberDescription { + money: FlowyMoney::default(), + scale: 0, + symbol: String::new(), + sign_positive: true, + name: String::new(), + } + } +} + +impl NumberDescription { + pub fn set_money(&mut self, money: FlowyMoney) { + self.money = money; + self.symbol = money.symbol(); + } + + fn money_from_str(&self, s: &str) -> Option { + match Decimal::from_str(s) { + Ok(mut decimal) => { + match decimal.set_scale(self.scale) { + Ok(_) => {} + Err(e) => { + tracing::error!("Set decimal scale failed: {:?}", e); + } + } + decimal.set_sign_positive(self.sign_positive); + Some(self.money.with_decimal(decimal).to_string()) + } + Err(e) => { + tracing::error!("Parser money from {} failed: {:?}", s, e); + None + } + } + } +} + +impl DisplayCell for NumberDescription { + fn display_content(&self, s: &str) -> String { + match self.money_from_str(&s) { + Some(money_str) => money_str, + None => String::default(), + } + } +} + +impl StringifyAnyData for NumberDescription { + fn stringify_any_data(&self, data: &AnyData) -> String { + match String::from_utf8(data.value.clone()) { + Ok(s) => match self.money_from_str(&s) { + Some(money_str) => money_str, + None => String::default(), + }, + Err(e) => { + tracing::error!("NumberDescription stringify any_data failed. {:?}", e); + String::new() + } + } + } + + fn str_to_any_data(&self, s: &str) -> Result { + let strip_symbol_money = strip_money_symbol(s); + let decimal = Decimal::from_str(&strip_symbol_money).map_err(|err| FlowyError::internal().context(err))?; + let money_str = decimal.to_string(); + Ok(AnyData::from_str(&NumberDescription::field_type(), &money_str)) + } +} + +#[derive(Clone, Copy, Debug, EnumIter, ProtoBuf_Enum)] +pub enum FlowyMoney { + CNY = 0, + EUR = 1, + USD = 2, +} + +impl std::default::Default for FlowyMoney { + fn default() -> Self { + FlowyMoney::USD + } +} + +impl FlowyMoney { + // Currency list https://docs.rs/rusty-money/0.4.0/rusty_money/iso/index.html + pub fn from_str(s: &str) -> FlowyMoney { + match s { + "CNY" => FlowyMoney::CNY, + "EUR" => FlowyMoney::EUR, + "USD" => FlowyMoney::USD, + _ => FlowyMoney::CNY, + } + } + + pub fn from_money(money: &rusty_money::Money) -> FlowyMoney { + FlowyMoney::from_str(&money.currency().symbol.to_string()) + } + + pub fn currency(&self) -> &'static Currency { + match self { + FlowyMoney::CNY => CNY, + FlowyMoney::EUR => EUR, + FlowyMoney::USD => USD, + } + } + + // string_to_money("¥18,443").unwrap(); + // string_to_money("$18,443").unwrap(); + // string_to_money("€18,443").unwrap(); + pub fn code(&self) -> String { + self.currency().iso_alpha_code.to_string() + } + + pub fn symbol(&self) -> String { + self.currency().symbol.to_string() + } + + pub fn zero(&self) -> Money { + let mut decimal = Decimal::new(0, 0); + decimal.set_sign_positive(true); + self.with_decimal(decimal) + } + + pub fn with_decimal(&self, decimal: Decimal) -> Money { + let money = rusty_money::Money::from_decimal(decimal, self.currency()); + money + } +} diff --git a/frontend/rust-lib/flowy-grid/src/cell_service/mod.rs b/frontend/rust-lib/flowy-grid/src/cell_service/mod.rs new file mode 100644 index 0000000000..b781258695 --- /dev/null +++ b/frontend/rust-lib/flowy-grid/src/cell_service/mod.rs @@ -0,0 +1,5 @@ +mod stringify; +mod util; + +pub mod cell_data; +pub use stringify::*; diff --git a/frontend/rust-lib/flowy-grid/src/cell_service/stringify.rs b/frontend/rust-lib/flowy-grid/src/cell_service/stringify.rs new file mode 100644 index 0000000000..0163a38368 --- /dev/null +++ b/frontend/rust-lib/flowy-grid/src/cell_service/stringify.rs @@ -0,0 +1,30 @@ +use crate::cell_service::cell_data::*; +use crate::cell_service::util::*; +use flowy_error::FlowyError; +use flowy_grid_data_model::entities::{AnyData, Field, FieldType}; + +pub trait AnyDataSerde { + fn serialize(field: &Field, s: &str) -> Result { + match field.field_type { + FieldType::RichText => RichTextDescription::from(field).str_to_any_data(s), + FieldType::Number => NumberDescription::from(field).str_to_any_data(s), + FieldType::DateTime => DateDescription::from(field).str_to_any_data(s), + FieldType::SingleSelect => SingleSelect::from(field).str_to_any_data(s), + FieldType::MultiSelect => MultiSelect::from(field).str_to_any_data(s), + FieldType::Checkbox => CheckboxDescription::from(field).str_to_any_data(s), + } + } + + fn deserialize(data: &AnyData, field: &Field) -> Result { + let _ = check_type_id(data, field)?; + let s = match field.field_type { + FieldType::RichText => RichTextDescription::from(field).stringify_any_data(data), + FieldType::Number => NumberDescription::from(field).stringify_any_data(data), + FieldType::DateTime => DateDescription::from(field).stringify_any_data(data), + FieldType::SingleSelect => SingleSelect::from(field).stringify_any_data(data), + FieldType::MultiSelect => MultiSelect::from(field).stringify_any_data(data), + FieldType::Checkbox => CheckboxDescription::from(field).stringify_any_data(data), + }; + Ok(s) + } +} diff --git a/frontend/rust-lib/flowy-grid/src/cell_service/util.rs b/frontend/rust-lib/flowy-grid/src/cell_service/util.rs new file mode 100644 index 0000000000..7081b6d4f0 --- /dev/null +++ b/frontend/rust-lib/flowy-grid/src/cell_service/util.rs @@ -0,0 +1,129 @@ +use crate::cell_service::cell_data::FlowyMoney; +use flowy_error::FlowyError; +use flowy_grid_data_model::entities::{AnyData, Field, FieldType}; +use lazy_static::lazy_static; +use rust_decimal::Decimal; +use rusty_money::{iso::Currency, Money}; +use std::collections::HashMap; +use std::str::FromStr; +use strum::IntoEnumIterator; + +lazy_static! { + static ref CURRENCIES_BY_SYMBOL: HashMap = generate_currency_by_symbol(); +} + +#[allow(dead_code)] +fn generate_currency_by_symbol() -> HashMap { + let mut map: HashMap = HashMap::new(); + + for money in FlowyMoney::iter() { + map.insert(money.symbol(), money.currency()); + } + map +} + +#[allow(dead_code)] +pub fn string_to_money(money_str: &str) -> Option> { + let mut process_money_str = String::from(money_str); + let default_currency = FlowyMoney::from_str("CNY").currency(); + + if process_money_str.is_empty() { + return None; + } + + return if process_money_str.chars().all(char::is_numeric) { + match Money::from_str(&process_money_str, default_currency) { + Ok(money) => Some(money), + Err(_) => None, + } + } else { + let symbol = process_money_str.chars().next().unwrap().to_string(); + let mut currency = default_currency; + + for key in CURRENCIES_BY_SYMBOL.keys() { + if symbol.eq(key) { + currency = CURRENCIES_BY_SYMBOL.get(key).unwrap(); + crop_letters(&mut process_money_str, 1); + } + } + + match Money::from_str(&process_money_str, currency) { + Ok(money) => Some(money), + Err(_) => None, + } + }; +} + +#[allow(dead_code)] +pub fn money_from_str(s: &str) -> Option { + match Decimal::from_str(s) { + Ok(mut decimal) => { + match decimal.set_scale(0) { + Ok(_) => {} + Err(e) => { + tracing::error!("Set scale failed. {:?}", e); + } + } + decimal.set_sign_positive(true); + Some(FlowyMoney::USD.with_decimal(decimal).to_string()) + } + Err(e) => { + tracing::debug!("Format {} to money failed, {:?}", s, e); + None + } + } +} + +pub fn strip_money_symbol(money_str: &str) -> String { + let mut process_money_str = String::from(money_str); + + if !process_money_str.chars().all(char::is_numeric) { + let symbol = process_money_str.chars().next().unwrap().to_string(); + for key in CURRENCIES_BY_SYMBOL.keys() { + if symbol.eq(key) { + crop_letters(&mut process_money_str, 1); + } + } + } + process_money_str +} + +fn crop_letters(s: &mut String, pos: usize) { + match s.char_indices().nth(pos) { + Some((pos, _)) => { + s.drain(..pos); + } + None => { + s.clear(); + } + } +} + +pub fn string_to_bool(bool_str: &str) -> bool { + let lower_case_str: &str = &bool_str.to_lowercase(); + match lower_case_str { + "1" => true, + "true" => true, + "yes" => true, + "0" => false, + "false" => false, + "no" => false, + _ => false, + } +} + +pub fn uuid() -> String { + uuid::Uuid::new_v4().to_string() +} + +pub fn check_type_id(data: &AnyData, field: &Field) -> Result<(), FlowyError> { + let field_type = FieldType::from_type_id(&data.type_id).map_err(|e| FlowyError::internal().context(e))?; + if field_type != field.field_type { + tracing::error!( + "expected field type: {:?} but receive {:?} ", + field_type, + field.field_type + ); + } + Ok(()) +} diff --git a/frontend/rust-lib/flowy-grid/src/event_handler.rs b/frontend/rust-lib/flowy-grid/src/event_handler.rs index 0d7b0a9f90..765da724d5 100644 --- a/frontend/rust-lib/flowy-grid/src/event_handler.rs +++ b/frontend/rust-lib/flowy-grid/src/event_handler.rs @@ -1,7 +1,9 @@ use crate::controller::GridManager; use flowy_error::FlowyError; -use flowy_grid_data_model::entities::{CreateGridPayload, Grid, GridId}; -use lib_dispatch::prelude::{data_result, AppData, Data, DataResult}; +use flowy_grid_data_model::entities::{ + CreateGridPayload, Grid, GridId, RepeatedFieldOrder, RepeatedRow, RepeatedRowOrder, +}; +use lib_dispatch::prelude::{AppData, Data, DataResult}; use std::sync::Arc; #[tracing::instrument(skip(data, controller), err)] @@ -17,7 +19,37 @@ pub(crate) async fn open_grid_handler( data: Data, controller: AppData>, ) -> DataResult { - let params: GridId = data.into_inner(); + let _params: GridId = data.into_inner(); + + todo!() +} + +#[tracing::instrument(skip(data, controller), err)] +pub(crate) async fn get_rows_handler( + data: Data, + controller: AppData>, +) -> DataResult { + let row_orders: RepeatedRowOrder = data.into_inner(); + + todo!() +} + +#[tracing::instrument(skip(data, controller), err)] +pub(crate) async fn get_fields_handler( + data: Data, + controller: AppData>, +) -> DataResult { + let field_orders: RepeatedFieldOrder = data.into_inner(); + + todo!() +} + +#[tracing::instrument(skip(data, controller), err)] +pub(crate) async fn create_row_handler( + data: Data, + controller: AppData>, +) -> DataResult { + let id: GridId = data.into_inner(); todo!() } diff --git a/frontend/rust-lib/flowy-grid/src/event_map.rs b/frontend/rust-lib/flowy-grid/src/event_map.rs index b1caa3993f..3fce720d36 100644 --- a/frontend/rust-lib/flowy-grid/src/event_map.rs +++ b/frontend/rust-lib/flowy-grid/src/event_map.rs @@ -7,10 +7,12 @@ use strum_macros::Display; pub fn create(grid_manager: Arc) -> Module { let mut module = Module::new().name(env!("CARGO_PKG_NAME")).data(grid_manager); - module = module .event(GridEvent::CreateGrid, create_grid_handler) - .event(GridEvent::OpenGrid, open_grid_handler); + .event(GridEvent::OpenGrid, open_grid_handler) + .event(GridEvent::GetRows, get_rows_handler) + .event(GridEvent::GetFields, get_fields_handler) + .event(GridEvent::CreateRow, create_row_handler); module } @@ -23,4 +25,13 @@ pub enum GridEvent { #[event(input = "GridId", output = "Grid")] OpenGrid = 1, + + #[event(input = "RepeatedRowOrder", output = "RepeatedRow")] + GetRows = 2, + + #[event(input = "RepeatedFieldOrder", output = "RepeatedField")] + GetFields = 3, + + #[event(input = "GridId")] + CreateRow = 4, } diff --git a/frontend/rust-lib/flowy-grid/src/lib.rs b/frontend/rust-lib/flowy-grid/src/lib.rs index 65726c3dbd..b7a4baf831 100644 --- a/frontend/rust-lib/flowy-grid/src/lib.rs +++ b/frontend/rust-lib/flowy-grid/src/lib.rs @@ -1,5 +1,9 @@ +#[macro_use] +mod macros; + mod controller; mod event_handler; mod event_map; +mod cell_service; mod protobuf; diff --git a/frontend/rust-lib/flowy-grid/src/macros.rs b/frontend/rust-lib/flowy-grid/src/macros.rs new file mode 100644 index 0000000000..043dcccb44 --- /dev/null +++ b/frontend/rust-lib/flowy-grid/src/macros.rs @@ -0,0 +1,64 @@ +#[macro_export] +macro_rules! impl_any_data { + ($target: ident, $field_type:expr) => { + impl_field_type_data_from_field!($target); + impl_field_type_data_from_field_type_option!($target); + impl_type_option_from_field_data!($target, $field_type); + }; +} + +#[macro_export] +macro_rules! impl_field_type_data_from_field { + ($target: ident) => { + impl std::convert::From<&Field> for $target { + fn from(field: &Field) -> $target { + $target::from(&field.type_options) + } + } + }; +} + +#[macro_export] +macro_rules! impl_field_type_data_from_field_type_option { + ($target: ident) => { + impl std::convert::From<&AnyData> for $target { + fn from(any_data: &AnyData) -> $target { + match $target::try_from(Bytes::from(any_data.value.clone())) { + Ok(obj) => obj, + Err(err) => { + tracing::error!("{} convert from any data failed, {:?}", stringify!($target), err); + $target::default() + } + } + } + } + }; +} + +#[macro_export] +macro_rules! impl_type_option_from_field_data { + ($target: ident, $field_type:expr) => { + impl $target { + pub fn field_type() -> FieldType { + $field_type + } + } + + impl std::convert::From<$target> for AnyData { + fn from(field_data: $target) -> Self { + match field_data.try_into() { + Ok(bytes) => { + let bytes: Bytes = bytes; + AnyData::from_bytes(&$target::field_type(), bytes) + } + Err(e) => { + tracing::error!("Field type data convert to AnyData fail, error: {:?}", e); + // it's impossible to fail when unwrapping the default field type data + let default_bytes: Bytes = $target::default().try_into().unwrap(); + AnyData::from_bytes(&$target::field_type(), default_bytes) + } + } + } + } + }; +} diff --git a/frontend/rust-lib/flowy-grid/src/protobuf/model/cell_data.rs b/frontend/rust-lib/flowy-grid/src/protobuf/model/cell_data.rs new file mode 100644 index 0000000000..d173fe22d0 --- /dev/null +++ b/frontend/rust-lib/flowy-grid/src/protobuf/model/cell_data.rs @@ -0,0 +1,1655 @@ +// This file is generated by rust-protobuf 2.25.2. Do not edit +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_imports)] +#![allow(unused_results)] +//! Generated file from `cell_data.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_25_2; + +#[derive(PartialEq,Clone,Default)] +pub struct RichTextDescription { + // message fields + pub format: ::std::string::String, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a RichTextDescription { + fn default() -> &'a RichTextDescription { + ::default_instance() + } +} + +impl RichTextDescription { + pub fn new() -> RichTextDescription { + ::std::default::Default::default() + } + + // string format = 1; + + + pub fn get_format(&self) -> &str { + &self.format + } + pub fn clear_format(&mut self) { + self.format.clear(); + } + + // Param is passed by value, moved + pub fn set_format(&mut self, v: ::std::string::String) { + self.format = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_format(&mut self) -> &mut ::std::string::String { + &mut self.format + } + + // Take field + pub fn take_format(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.format, ::std::string::String::new()) + } +} + +impl ::protobuf::Message for RichTextDescription { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.format)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.format.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.format); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.format.is_empty() { + os.write_string(1, &self.format)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> RichTextDescription { + RichTextDescription::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "format", + |m: &RichTextDescription| { &m.format }, + |m: &mut RichTextDescription| { &mut m.format }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "RichTextDescription", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static RichTextDescription { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(RichTextDescription::new) + } +} + +impl ::protobuf::Clear for RichTextDescription { + fn clear(&mut self) { + self.format.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RichTextDescription { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RichTextDescription { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct CheckboxDescription { + // message fields + pub is_selected: bool, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a CheckboxDescription { + fn default() -> &'a CheckboxDescription { + ::default_instance() + } +} + +impl CheckboxDescription { + pub fn new() -> CheckboxDescription { + ::std::default::Default::default() + } + + // bool is_selected = 1; + + + pub fn get_is_selected(&self) -> bool { + self.is_selected + } + pub fn clear_is_selected(&mut self) { + self.is_selected = false; + } + + // Param is passed by value, moved + pub fn set_is_selected(&mut self, v: bool) { + self.is_selected = v; + } +} + +impl ::protobuf::Message for CheckboxDescription { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.is_selected = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.is_selected != false { + my_size += 2; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if self.is_selected != false { + os.write_bool(1, self.is_selected)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> CheckboxDescription { + CheckboxDescription::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "is_selected", + |m: &CheckboxDescription| { &m.is_selected }, + |m: &mut CheckboxDescription| { &mut m.is_selected }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "CheckboxDescription", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static CheckboxDescription { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(CheckboxDescription::new) + } +} + +impl ::protobuf::Clear for CheckboxDescription { + fn clear(&mut self) { + self.is_selected = false; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for CheckboxDescription { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CheckboxDescription { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct DateDescription { + // message fields + pub date_format: DateFormat, + pub time_format: TimeFormat, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a DateDescription { + fn default() -> &'a DateDescription { + ::default_instance() + } +} + +impl DateDescription { + pub fn new() -> DateDescription { + ::std::default::Default::default() + } + + // .DateFormat date_format = 1; + + + pub fn get_date_format(&self) -> DateFormat { + self.date_format + } + pub fn clear_date_format(&mut self) { + self.date_format = DateFormat::Local; + } + + // Param is passed by value, moved + pub fn set_date_format(&mut self, v: DateFormat) { + self.date_format = v; + } + + // .TimeFormat time_format = 2; + + + pub fn get_time_format(&self) -> TimeFormat { + self.time_format + } + pub fn clear_time_format(&mut self) { + self.time_format = TimeFormat::TwelveHour; + } + + // Param is passed by value, moved + pub fn set_time_format(&mut self, v: TimeFormat) { + self.time_format = v; + } +} + +impl ::protobuf::Message for DateDescription { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.date_format, 1, &mut self.unknown_fields)? + }, + 2 => { + ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.time_format, 2, &mut self.unknown_fields)? + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.date_format != DateFormat::Local { + my_size += ::protobuf::rt::enum_size(1, self.date_format); + } + if self.time_format != TimeFormat::TwelveHour { + my_size += ::protobuf::rt::enum_size(2, self.time_format); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if self.date_format != DateFormat::Local { + os.write_enum(1, ::protobuf::ProtobufEnum::value(&self.date_format))?; + } + if self.time_format != TimeFormat::TwelveHour { + os.write_enum(2, ::protobuf::ProtobufEnum::value(&self.time_format))?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> DateDescription { + DateDescription::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "date_format", + |m: &DateDescription| { &m.date_format }, + |m: &mut DateDescription| { &mut m.date_format }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "time_format", + |m: &DateDescription| { &m.time_format }, + |m: &mut DateDescription| { &mut m.time_format }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "DateDescription", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static DateDescription { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(DateDescription::new) + } +} + +impl ::protobuf::Clear for DateDescription { + fn clear(&mut self) { + self.date_format = DateFormat::Local; + self.time_format = TimeFormat::TwelveHour; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for DateDescription { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for DateDescription { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct SingleSelect { + // message fields + pub options: ::protobuf::RepeatedField, + pub disable_color: bool, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a SingleSelect { + fn default() -> &'a SingleSelect { + ::default_instance() + } +} + +impl SingleSelect { + pub fn new() -> SingleSelect { + ::std::default::Default::default() + } + + // repeated .SelectOption options = 1; + + + pub fn get_options(&self) -> &[SelectOption] { + &self.options + } + pub fn clear_options(&mut self) { + self.options.clear(); + } + + // Param is passed by value, moved + pub fn set_options(&mut self, v: ::protobuf::RepeatedField) { + self.options = v; + } + + // Mutable pointer to the field. + pub fn mut_options(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.options + } + + // Take field + pub fn take_options(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.options, ::protobuf::RepeatedField::new()) + } + + // bool disable_color = 2; + + + pub fn get_disable_color(&self) -> bool { + self.disable_color + } + pub fn clear_disable_color(&mut self) { + self.disable_color = false; + } + + // Param is passed by value, moved + pub fn set_disable_color(&mut self, v: bool) { + self.disable_color = v; + } +} + +impl ::protobuf::Message for SingleSelect { + fn is_initialized(&self) -> bool { + for v in &self.options { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.options)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.disable_color = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + for value in &self.options { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + if self.disable_color != false { + my_size += 2; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + for v in &self.options { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + if self.disable_color != false { + os.write_bool(2, self.disable_color)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> SingleSelect { + SingleSelect::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "options", + |m: &SingleSelect| { &m.options }, + |m: &mut SingleSelect| { &mut m.options }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "disable_color", + |m: &SingleSelect| { &m.disable_color }, + |m: &mut SingleSelect| { &mut m.disable_color }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "SingleSelect", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static SingleSelect { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(SingleSelect::new) + } +} + +impl ::protobuf::Clear for SingleSelect { + fn clear(&mut self) { + self.options.clear(); + self.disable_color = false; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for SingleSelect { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for SingleSelect { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct MultiSelect { + // message fields + pub options: ::protobuf::RepeatedField, + pub disable_color: bool, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a MultiSelect { + fn default() -> &'a MultiSelect { + ::default_instance() + } +} + +impl MultiSelect { + pub fn new() -> MultiSelect { + ::std::default::Default::default() + } + + // repeated .SelectOption options = 1; + + + pub fn get_options(&self) -> &[SelectOption] { + &self.options + } + pub fn clear_options(&mut self) { + self.options.clear(); + } + + // Param is passed by value, moved + pub fn set_options(&mut self, v: ::protobuf::RepeatedField) { + self.options = v; + } + + // Mutable pointer to the field. + pub fn mut_options(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.options + } + + // Take field + pub fn take_options(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.options, ::protobuf::RepeatedField::new()) + } + + // bool disable_color = 2; + + + pub fn get_disable_color(&self) -> bool { + self.disable_color + } + pub fn clear_disable_color(&mut self) { + self.disable_color = false; + } + + // Param is passed by value, moved + pub fn set_disable_color(&mut self, v: bool) { + self.disable_color = v; + } +} + +impl ::protobuf::Message for MultiSelect { + fn is_initialized(&self) -> bool { + for v in &self.options { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.options)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.disable_color = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + for value in &self.options { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + if self.disable_color != false { + my_size += 2; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + for v in &self.options { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + if self.disable_color != false { + os.write_bool(2, self.disable_color)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> MultiSelect { + MultiSelect::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "options", + |m: &MultiSelect| { &m.options }, + |m: &mut MultiSelect| { &mut m.options }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "disable_color", + |m: &MultiSelect| { &m.disable_color }, + |m: &mut MultiSelect| { &mut m.disable_color }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "MultiSelect", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static MultiSelect { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(MultiSelect::new) + } +} + +impl ::protobuf::Clear for MultiSelect { + fn clear(&mut self) { + self.options.clear(); + self.disable_color = false; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for MultiSelect { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MultiSelect { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct SelectOption { + // message fields + pub id: ::std::string::String, + pub name: ::std::string::String, + pub color: ::std::string::String, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a SelectOption { + fn default() -> &'a SelectOption { + ::default_instance() + } +} + +impl SelectOption { + pub fn new() -> SelectOption { + ::std::default::Default::default() + } + + // string id = 1; + + + pub fn get_id(&self) -> &str { + &self.id + } + pub fn clear_id(&mut self) { + self.id.clear(); + } + + // Param is passed by value, moved + pub fn set_id(&mut self, v: ::std::string::String) { + self.id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_id(&mut self) -> &mut ::std::string::String { + &mut self.id + } + + // Take field + pub fn take_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.id, ::std::string::String::new()) + } + + // string name = 2; + + + pub fn get_name(&self) -> &str { + &self.name + } + pub fn clear_name(&mut self) { + self.name.clear(); + } + + // Param is passed by value, moved + pub fn set_name(&mut self, v: ::std::string::String) { + self.name = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_name(&mut self) -> &mut ::std::string::String { + &mut self.name + } + + // Take field + pub fn take_name(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.name, ::std::string::String::new()) + } + + // string color = 3; + + + pub fn get_color(&self) -> &str { + &self.color + } + pub fn clear_color(&mut self) { + self.color.clear(); + } + + // Param is passed by value, moved + pub fn set_color(&mut self, v: ::std::string::String) { + self.color = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_color(&mut self) -> &mut ::std::string::String { + &mut self.color + } + + // Take field + pub fn take_color(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.color, ::std::string::String::new()) + } +} + +impl ::protobuf::Message for SelectOption { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.id)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.color)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.id); + } + if !self.name.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.name); + } + if !self.color.is_empty() { + my_size += ::protobuf::rt::string_size(3, &self.color); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if !self.id.is_empty() { + os.write_string(1, &self.id)?; + } + if !self.name.is_empty() { + os.write_string(2, &self.name)?; + } + if !self.color.is_empty() { + os.write_string(3, &self.color)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> SelectOption { + SelectOption::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "id", + |m: &SelectOption| { &m.id }, + |m: &mut SelectOption| { &mut m.id }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "name", + |m: &SelectOption| { &m.name }, + |m: &mut SelectOption| { &mut m.name }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "color", + |m: &SelectOption| { &m.color }, + |m: &mut SelectOption| { &mut m.color }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "SelectOption", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static SelectOption { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(SelectOption::new) + } +} + +impl ::protobuf::Clear for SelectOption { + fn clear(&mut self) { + self.id.clear(); + self.name.clear(); + self.color.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for SelectOption { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for SelectOption { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct NumberDescription { + // message fields + pub money: FlowyMoney, + pub scale: u32, + pub symbol: ::std::string::String, + pub sign_positive: bool, + pub name: ::std::string::String, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a NumberDescription { + fn default() -> &'a NumberDescription { + ::default_instance() + } +} + +impl NumberDescription { + pub fn new() -> NumberDescription { + ::std::default::Default::default() + } + + // .FlowyMoney money = 1; + + + pub fn get_money(&self) -> FlowyMoney { + self.money + } + pub fn clear_money(&mut self) { + self.money = FlowyMoney::CNY; + } + + // Param is passed by value, moved + pub fn set_money(&mut self, v: FlowyMoney) { + self.money = v; + } + + // uint32 scale = 2; + + + pub fn get_scale(&self) -> u32 { + self.scale + } + pub fn clear_scale(&mut self) { + self.scale = 0; + } + + // Param is passed by value, moved + pub fn set_scale(&mut self, v: u32) { + self.scale = v; + } + + // string symbol = 3; + + + pub fn get_symbol(&self) -> &str { + &self.symbol + } + pub fn clear_symbol(&mut self) { + self.symbol.clear(); + } + + // Param is passed by value, moved + pub fn set_symbol(&mut self, v: ::std::string::String) { + self.symbol = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_symbol(&mut self) -> &mut ::std::string::String { + &mut self.symbol + } + + // Take field + pub fn take_symbol(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.symbol, ::std::string::String::new()) + } + + // bool sign_positive = 4; + + + pub fn get_sign_positive(&self) -> bool { + self.sign_positive + } + pub fn clear_sign_positive(&mut self) { + self.sign_positive = false; + } + + // Param is passed by value, moved + pub fn set_sign_positive(&mut self, v: bool) { + self.sign_positive = v; + } + + // string name = 5; + + + pub fn get_name(&self) -> &str { + &self.name + } + pub fn clear_name(&mut self) { + self.name.clear(); + } + + // Param is passed by value, moved + pub fn set_name(&mut self, v: ::std::string::String) { + self.name = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_name(&mut self) -> &mut ::std::string::String { + &mut self.name + } + + // Take field + pub fn take_name(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.name, ::std::string::String::new()) + } +} + +impl ::protobuf::Message for NumberDescription { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.money, 1, &mut self.unknown_fields)? + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.scale = tmp; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.symbol)?; + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.sign_positive = tmp; + }, + 5 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.money != FlowyMoney::CNY { + my_size += ::protobuf::rt::enum_size(1, self.money); + } + if self.scale != 0 { + my_size += ::protobuf::rt::value_size(2, self.scale, ::protobuf::wire_format::WireTypeVarint); + } + if !self.symbol.is_empty() { + my_size += ::protobuf::rt::string_size(3, &self.symbol); + } + if self.sign_positive != false { + my_size += 2; + } + if !self.name.is_empty() { + my_size += ::protobuf::rt::string_size(5, &self.name); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + if self.money != FlowyMoney::CNY { + os.write_enum(1, ::protobuf::ProtobufEnum::value(&self.money))?; + } + if self.scale != 0 { + os.write_uint32(2, self.scale)?; + } + if !self.symbol.is_empty() { + os.write_string(3, &self.symbol)?; + } + if self.sign_positive != false { + os.write_bool(4, self.sign_positive)?; + } + if !self.name.is_empty() { + os.write_string(5, &self.name)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> NumberDescription { + NumberDescription::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "money", + |m: &NumberDescription| { &m.money }, + |m: &mut NumberDescription| { &mut m.money }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "scale", + |m: &NumberDescription| { &m.scale }, + |m: &mut NumberDescription| { &mut m.scale }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "symbol", + |m: &NumberDescription| { &m.symbol }, + |m: &mut NumberDescription| { &mut m.symbol }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "sign_positive", + |m: &NumberDescription| { &m.sign_positive }, + |m: &mut NumberDescription| { &mut m.sign_positive }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "name", + |m: &NumberDescription| { &m.name }, + |m: &mut NumberDescription| { &mut m.name }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "NumberDescription", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static NumberDescription { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(NumberDescription::new) + } +} + +impl ::protobuf::Clear for NumberDescription { + fn clear(&mut self) { + self.money = FlowyMoney::CNY; + self.scale = 0; + self.symbol.clear(); + self.sign_positive = false; + self.name.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for NumberDescription { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for NumberDescription { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum DateFormat { + Local = 0, + US = 1, + ISO = 2, + Friendly = 3, +} + +impl ::protobuf::ProtobufEnum for DateFormat { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(DateFormat::Local), + 1 => ::std::option::Option::Some(DateFormat::US), + 2 => ::std::option::Option::Some(DateFormat::ISO), + 3 => ::std::option::Option::Some(DateFormat::Friendly), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [DateFormat] = &[ + DateFormat::Local, + DateFormat::US, + DateFormat::ISO, + DateFormat::Friendly, + ]; + values + } + + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new_pb_name::("DateFormat", file_descriptor_proto()) + }) + } +} + +impl ::std::marker::Copy for DateFormat { +} + +impl ::std::default::Default for DateFormat { + fn default() -> Self { + DateFormat::Local + } +} + +impl ::protobuf::reflect::ProtobufValue for DateFormat { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self)) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum TimeFormat { + TwelveHour = 0, + TwentyFourHour = 1, +} + +impl ::protobuf::ProtobufEnum for TimeFormat { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(TimeFormat::TwelveHour), + 1 => ::std::option::Option::Some(TimeFormat::TwentyFourHour), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [TimeFormat] = &[ + TimeFormat::TwelveHour, + TimeFormat::TwentyFourHour, + ]; + values + } + + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new_pb_name::("TimeFormat", file_descriptor_proto()) + }) + } +} + +impl ::std::marker::Copy for TimeFormat { +} + +impl ::std::default::Default for TimeFormat { + fn default() -> Self { + TimeFormat::TwelveHour + } +} + +impl ::protobuf::reflect::ProtobufValue for TimeFormat { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self)) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum FlowyMoney { + CNY = 0, + EUR = 1, + USD = 2, +} + +impl ::protobuf::ProtobufEnum for FlowyMoney { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(FlowyMoney::CNY), + 1 => ::std::option::Option::Some(FlowyMoney::EUR), + 2 => ::std::option::Option::Some(FlowyMoney::USD), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [FlowyMoney] = &[ + FlowyMoney::CNY, + FlowyMoney::EUR, + FlowyMoney::USD, + ]; + values + } + + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new_pb_name::("FlowyMoney", file_descriptor_proto()) + }) + } +} + +impl ::std::marker::Copy for FlowyMoney { +} + +impl ::std::default::Default for FlowyMoney { + fn default() -> Self { + FlowyMoney::CNY + } +} + +impl ::protobuf::reflect::ProtobufValue for FlowyMoney { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self)) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x0fcell_data.proto\"-\n\x13RichTextDescription\x12\x16\n\x06format\ + \x18\x01\x20\x01(\tR\x06format\"6\n\x13CheckboxDescription\x12\x1f\n\x0b\ + is_selected\x18\x01\x20\x01(\x08R\nisSelected\"m\n\x0fDateDescription\ + \x12,\n\x0bdate_format\x18\x01\x20\x01(\x0e2\x0b.DateFormatR\ndateFormat\ + \x12,\n\x0btime_format\x18\x02\x20\x01(\x0e2\x0b.TimeFormatR\ntimeFormat\ + \"\\\n\x0cSingleSelect\x12'\n\x07options\x18\x01\x20\x03(\x0b2\r.SelectO\ + ptionR\x07options\x12#\n\rdisable_color\x18\x02\x20\x01(\x08R\x0cdisable\ + Color\"[\n\x0bMultiSelect\x12'\n\x07options\x18\x01\x20\x03(\x0b2\r.Sele\ + ctOptionR\x07options\x12#\n\rdisable_color\x18\x02\x20\x01(\x08R\x0cdisa\ + bleColor\"H\n\x0cSelectOption\x12\x0e\n\x02id\x18\x01\x20\x01(\tR\x02id\ + \x12\x12\n\x04name\x18\x02\x20\x01(\tR\x04name\x12\x14\n\x05color\x18\ + \x03\x20\x01(\tR\x05color\"\x9d\x01\n\x11NumberDescription\x12!\n\x05mon\ + ey\x18\x01\x20\x01(\x0e2\x0b.FlowyMoneyR\x05money\x12\x14\n\x05scale\x18\ + \x02\x20\x01(\rR\x05scale\x12\x16\n\x06symbol\x18\x03\x20\x01(\tR\x06sym\ + bol\x12#\n\rsign_positive\x18\x04\x20\x01(\x08R\x0csignPositive\x12\x12\ + \n\x04name\x18\x05\x20\x01(\tR\x04name*6\n\nDateFormat\x12\t\n\x05Local\ + \x10\0\x12\x06\n\x02US\x10\x01\x12\x07\n\x03ISO\x10\x02\x12\x0c\n\x08Fri\ + endly\x10\x03*0\n\nTimeFormat\x12\x0e\n\nTwelveHour\x10\0\x12\x12\n\x0eT\ + wentyFourHour\x10\x01*'\n\nFlowyMoney\x12\x07\n\x03CNY\x10\0\x12\x07\n\ + \x03EUR\x10\x01\x12\x07\n\x03USD\x10\x02b\x06proto3\ +"; + +static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) +} 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 d4c95c928b..b2456ff055 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 @@ -27,6 +27,9 @@ pub enum GridEvent { CreateGrid = 0, OpenGrid = 1, + GetRows = 2, + GetFields = 3, + CreateRow = 4, } impl ::protobuf::ProtobufEnum for GridEvent { @@ -38,6 +41,9 @@ impl ::protobuf::ProtobufEnum for GridEvent { match value { 0 => ::std::option::Option::Some(GridEvent::CreateGrid), 1 => ::std::option::Option::Some(GridEvent::OpenGrid), + 2 => ::std::option::Option::Some(GridEvent::GetRows), + 3 => ::std::option::Option::Some(GridEvent::GetFields), + 4 => ::std::option::Option::Some(GridEvent::CreateRow), _ => ::std::option::Option::None } } @@ -46,6 +52,9 @@ impl ::protobuf::ProtobufEnum for GridEvent { static values: &'static [GridEvent] = &[ GridEvent::CreateGrid, GridEvent::OpenGrid, + GridEvent::GetRows, + GridEvent::GetFields, + GridEvent::CreateRow, ]; values } @@ -74,8 +83,9 @@ impl ::protobuf::reflect::ProtobufValue for GridEvent { } static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x0fevent_map.proto*)\n\tGridEvent\x12\x0e\n\nCreateGrid\x10\0\x12\x0c\ - \n\x08OpenGrid\x10\x01b\x06proto3\ + \n\x0fevent_map.proto*T\n\tGridEvent\x12\x0e\n\nCreateGrid\x10\0\x12\x0c\ + \n\x08OpenGrid\x10\x01\x12\x0b\n\x07GetRows\x10\x02\x12\r\n\tGetFields\ + \x10\x03\x12\r\n\tCreateRow\x10\x04b\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 56c0b3d949..55aeddc863 100644 --- a/frontend/rust-lib/flowy-grid/src/protobuf/model/mod.rs +++ b/frontend/rust-lib/flowy-grid/src/protobuf/model/mod.rs @@ -1,5 +1,8 @@ #![cfg_attr(rustfmt, rustfmt::skip)] // Auto-generated, do not edit +mod cell_data; +pub use cell_data::*; + mod event_map; pub use event_map::*; diff --git a/frontend/rust-lib/flowy-grid/src/protobuf/proto/cell_data.proto b/frontend/rust-lib/flowy-grid/src/protobuf/proto/cell_data.proto new file mode 100644 index 0000000000..dc146af19e --- /dev/null +++ b/frontend/rust-lib/flowy-grid/src/protobuf/proto/cell_data.proto @@ -0,0 +1,47 @@ +syntax = "proto3"; + +message RichTextDescription { + string format = 1; +} +message CheckboxDescription { + bool is_selected = 1; +} +message DateDescription { + DateFormat date_format = 1; + TimeFormat time_format = 2; +} +message SingleSelect { + repeated SelectOption options = 1; + bool disable_color = 2; +} +message MultiSelect { + repeated SelectOption options = 1; + bool disable_color = 2; +} +message SelectOption { + string id = 1; + string name = 2; + string color = 3; +} +message NumberDescription { + FlowyMoney money = 1; + uint32 scale = 2; + string symbol = 3; + bool sign_positive = 4; + string name = 5; +} +enum DateFormat { + Local = 0; + US = 1; + ISO = 2; + Friendly = 3; +} +enum TimeFormat { + TwelveHour = 0; + TwentyFourHour = 1; +} +enum FlowyMoney { + CNY = 0; + EUR = 1; + USD = 2; +} 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 f1a860aee0..82819b6bd5 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 @@ -3,4 +3,7 @@ syntax = "proto3"; enum GridEvent { CreateGrid = 0; OpenGrid = 1; + GetRows = 2; + GetFields = 3; + CreateRow = 4; } diff --git a/shared-lib/Cargo.lock b/shared-lib/Cargo.lock index 5b242f5fd6..4afa34ed29 100644 --- a/shared-lib/Cargo.lock +++ b/shared-lib/Cargo.lock @@ -486,6 +486,8 @@ dependencies = [ "flowy-derive", "lib-infra", "protobuf", + "strum", + "strum_macros", ] [[package]] diff --git a/shared-lib/flowy-grid-data-model/Cargo.toml b/shared-lib/flowy-grid-data-model/Cargo.toml index c929ab4b76..8281121c44 100644 --- a/shared-lib/flowy-grid-data-model/Cargo.toml +++ b/shared-lib/flowy-grid-data-model/Cargo.toml @@ -9,6 +9,8 @@ edition = "2021" flowy-derive = { path = "../flowy-derive" } protobuf = {version = "2.18.0"} bytes = "1.0" +strum = "0.21" +strum_macros = "0.21" [build-dependencies] lib-infra = { path = "../lib-infra", features = ["protobuf_file_gen"] } diff --git a/shared-lib/flowy-grid-data-model/src/entities/grid.rs b/shared-lib/flowy-grid-data-model/src/entities/grid.rs index a0c5d919d3..03e738faee 100644 --- a/shared-lib/flowy-grid-data-model/src/entities/grid.rs +++ b/shared-lib/flowy-grid-data-model/src/entities/grid.rs @@ -1,6 +1,8 @@ use flowy_derive::{ProtoBuf, ProtoBuf_Enum}; use std::collections::HashMap; +use strum_macros::{Display, EnumIter, EnumString}; + #[derive(Debug, Default, ProtoBuf)] pub struct Grid { #[pb(index = 1)] @@ -41,9 +43,6 @@ pub struct FieldOrder { #[pb(index = 2)] pub visibility: bool, - - #[pb(index = 3)] - pub width: i32, } #[derive(Debug, Default, ProtoBuf)] @@ -53,7 +52,6 @@ pub struct RepeatedFieldOrder { } #[derive(Debug, Default, ProtoBuf)] - pub struct Field { #[pb(index = 1)] pub id: String, @@ -71,10 +69,19 @@ pub struct Field { pub frozen: bool, #[pb(index = 6)] + pub width: i32, + + #[pb(index = 7)] pub type_options: AnyData, } -#[derive(Debug, ProtoBuf_Enum)] +#[derive(Debug, Default, ProtoBuf)] +pub struct RepeatedField { + #[pb(index = 1)] + pub items: Vec, +} + +#[derive(Debug, Clone, PartialEq, Eq, ProtoBuf_Enum, EnumString, EnumIter, Display)] pub enum FieldType { RichText = 0, Number = 1, @@ -90,15 +97,57 @@ impl std::default::Default for FieldType { } } +impl FieldType { + #[allow(dead_code)] + pub fn type_id(&self) -> String { + let ty = self.clone(); + format!("{}", ty as u8) + } + + pub fn from_type_id(type_id: &str) -> Result { + match type_id { + "0" => Ok(FieldType::RichText), + "1" => Ok(FieldType::Number), + "2" => Ok(FieldType::DateTime), + "3" => Ok(FieldType::SingleSelect), + "4" => Ok(FieldType::MultiSelect), + "5" => Ok(FieldType::Checkbox), + _ => Err(format!("Invalid type_id: {}", type_id)), + } + } +} + #[derive(Debug, Default, ProtoBuf)] pub struct AnyData { #[pb(index = 1)] - pub type_url: String, + pub type_id: String, #[pb(index = 2)] pub value: Vec, } +impl AnyData { + pub fn from_str(field_type: &FieldType, s: &str) -> AnyData { + Self::from_bytes(field_type, s.as_bytes().to_vec()) + } + + pub fn from_bytes>(field_type: &FieldType, bytes: T) -> AnyData { + AnyData { + type_id: field_type.type_id(), + value: bytes.as_ref().to_vec(), + } + } +} + +impl ToString for AnyData { + fn to_string(&self) -> String { + match String::from_utf8(self.value.clone()) { + Ok(s) => s, + Err(_) => "".to_owned(), + } + } +} + #[derive(Debug, Default, ProtoBuf)] pub struct RowOrder { #[pb(index = 1)] @@ -118,7 +167,7 @@ pub struct RepeatedRowOrder { } #[derive(Debug, Default, ProtoBuf)] -pub struct Row { +pub struct GridRow { #[pb(index = 1)] pub id: String, @@ -129,11 +178,17 @@ pub struct Row { pub modified_time: i64, #[pb(index = 4)] - pub cell_by_field_id: HashMap, + pub cell_by_field_id: HashMap, } #[derive(Debug, Default, ProtoBuf)] -pub struct Cell { +pub struct RepeatedRow { + #[pb(index = 1)] + pub items: Vec, +} + +#[derive(Debug, Default, ProtoBuf)] +pub struct GridCell { #[pb(index = 1)] pub id: String, @@ -142,26 +197,11 @@ pub struct Cell { #[pb(index = 3)] pub field_id: String, -} -#[derive(Debug, Default, ProtoBuf)] -pub struct DisplayCell { - #[pb(index = 1)] - pub id: String, - - #[pb(index = 2)] + #[pb(index = 4)] pub content: String, } -#[derive(Debug, Default, ProtoBuf)] -pub struct RawCell { - #[pb(index = 1)] - pub id: String, - - #[pb(index = 2)] - pub data: AnyData, -} - #[derive(ProtoBuf, Default)] pub struct CreateGridPayload { #[pb(index = 1)] diff --git a/shared-lib/flowy-grid-data-model/src/protobuf/model/grid.rs b/shared-lib/flowy-grid-data-model/src/protobuf/model/grid.rs index 52bbd4f113..820ac7404c 100644 --- a/shared-lib/flowy-grid-data-model/src/protobuf/model/grid.rs +++ b/shared-lib/flowy-grid-data-model/src/protobuf/model/grid.rs @@ -767,7 +767,6 @@ pub struct FieldOrder { // message fields pub field_id: ::std::string::String, pub visibility: bool, - pub width: i32, // special fields pub unknown_fields: ::protobuf::UnknownFields, pub cached_size: ::protobuf::CachedSize, @@ -824,21 +823,6 @@ impl FieldOrder { pub fn set_visibility(&mut self, v: bool) { self.visibility = v; } - - // int32 width = 3; - - - pub fn get_width(&self) -> i32 { - self.width - } - pub fn clear_width(&mut self) { - self.width = 0; - } - - // Param is passed by value, moved - pub fn set_width(&mut self, v: i32) { - self.width = v; - } } impl ::protobuf::Message for FieldOrder { @@ -860,13 +844,6 @@ impl ::protobuf::Message for FieldOrder { let tmp = is.read_bool()?; self.visibility = tmp; }, - 3 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_int32()?; - self.width = tmp; - }, _ => { ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; }, @@ -885,9 +862,6 @@ impl ::protobuf::Message for FieldOrder { if self.visibility != false { my_size += 2; } - if self.width != 0 { - my_size += ::protobuf::rt::value_size(3, self.width, ::protobuf::wire_format::WireTypeVarint); - } my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); self.cached_size.set(my_size); my_size @@ -900,9 +874,6 @@ impl ::protobuf::Message for FieldOrder { if self.visibility != false { os.write_bool(2, self.visibility)?; } - if self.width != 0 { - os.write_int32(3, self.width)?; - } os.write_unknown_fields(self.get_unknown_fields())?; ::std::result::Result::Ok(()) } @@ -951,11 +922,6 @@ impl ::protobuf::Message for FieldOrder { |m: &FieldOrder| { &m.visibility }, |m: &mut FieldOrder| { &mut m.visibility }, )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( - "width", - |m: &FieldOrder| { &m.width }, - |m: &mut FieldOrder| { &mut m.width }, - )); ::protobuf::reflect::MessageDescriptor::new_pb_name::( "FieldOrder", fields, @@ -974,7 +940,6 @@ impl ::protobuf::Clear for FieldOrder { fn clear(&mut self) { self.field_id.clear(); self.visibility = false; - self.width = 0; self.unknown_fields.clear(); } } @@ -1165,6 +1130,7 @@ pub struct Field { pub desc: ::std::string::String, pub field_type: FieldType, pub frozen: bool, + pub width: i32, pub type_options: ::protobuf::SingularPtrField, // special fields pub unknown_fields: ::protobuf::UnknownFields, @@ -1290,7 +1256,22 @@ impl Field { self.frozen = v; } - // .AnyData type_options = 6; + // int32 width = 6; + + + pub fn get_width(&self) -> i32 { + self.width + } + pub fn clear_width(&mut self) { + self.width = 0; + } + + // Param is passed by value, moved + pub fn set_width(&mut self, v: i32) { + self.width = v; + } + + // .AnyData type_options = 7; pub fn get_type_options(&self) -> &AnyData { @@ -1358,6 +1339,13 @@ impl ::protobuf::Message for Field { self.frozen = tmp; }, 6 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int32()?; + self.width = tmp; + }, + 7 => { ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.type_options)?; }, _ => { @@ -1387,6 +1375,9 @@ impl ::protobuf::Message for Field { if self.frozen != false { my_size += 2; } + if self.width != 0 { + my_size += ::protobuf::rt::value_size(6, self.width, ::protobuf::wire_format::WireTypeVarint); + } if let Some(ref v) = self.type_options.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; @@ -1412,8 +1403,11 @@ impl ::protobuf::Message for Field { if self.frozen != false { os.write_bool(5, self.frozen)?; } + if self.width != 0 { + os.write_int32(6, self.width)?; + } if let Some(ref v) = self.type_options.as_ref() { - os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_tag(7, ::protobuf::wire_format::WireTypeLengthDelimited)?; os.write_raw_varint32(v.get_cached_size())?; v.write_to_with_cached_sizes(os)?; } @@ -1480,6 +1474,11 @@ impl ::protobuf::Message for Field { |m: &Field| { &m.frozen }, |m: &mut Field| { &mut m.frozen }, )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( + "width", + |m: &Field| { &m.width }, + |m: &mut Field| { &mut m.width }, + )); fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "type_options", |m: &Field| { &m.type_options }, @@ -1506,6 +1505,7 @@ impl ::protobuf::Clear for Field { self.desc.clear(); self.field_type = FieldType::RichText; self.frozen = false; + self.width = 0; self.type_options.clear(); self.unknown_fields.clear(); } @@ -1523,10 +1523,176 @@ impl ::protobuf::reflect::ProtobufValue for Field { } } +#[derive(PartialEq,Clone,Default)] +pub struct RepeatedField { + // message fields + pub items: ::protobuf::RepeatedField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a RepeatedField { + fn default() -> &'a RepeatedField { + ::default_instance() + } +} + +impl RepeatedField { + pub fn new() -> RepeatedField { + ::std::default::Default::default() + } + + // repeated .Field items = 1; + + + pub fn get_items(&self) -> &[Field] { + &self.items + } + pub fn clear_items(&mut self) { + self.items.clear(); + } + + // Param is passed by value, moved + pub fn set_items(&mut self, v: ::protobuf::RepeatedField) { + self.items = v; + } + + // Mutable pointer to the field. + pub fn mut_items(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.items + } + + // Take field + pub fn take_items(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.items, ::protobuf::RepeatedField::new()) + } +} + +impl ::protobuf::Message for RepeatedField { + fn is_initialized(&self) -> bool { + for v in &self.items { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.items)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + for value in &self.items { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + for v in &self.items { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> RepeatedField { + RepeatedField::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "items", + |m: &RepeatedField| { &m.items }, + |m: &mut RepeatedField| { &mut m.items }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "RepeatedField", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static RepeatedField { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(RepeatedField::new) + } +} + +impl ::protobuf::Clear for RepeatedField { + fn clear(&mut self) { + self.items.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RepeatedField { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RepeatedField { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + #[derive(PartialEq,Clone,Default)] pub struct AnyData { // message fields - pub type_url: ::std::string::String, + pub type_id: ::std::string::String, pub value: ::std::vec::Vec, // special fields pub unknown_fields: ::protobuf::UnknownFields, @@ -1544,30 +1710,30 @@ impl AnyData { ::std::default::Default::default() } - // string type_url = 1; + // string type_id = 1; - pub fn get_type_url(&self) -> &str { - &self.type_url + pub fn get_type_id(&self) -> &str { + &self.type_id } - pub fn clear_type_url(&mut self) { - self.type_url.clear(); + pub fn clear_type_id(&mut self) { + self.type_id.clear(); } // Param is passed by value, moved - pub fn set_type_url(&mut self, v: ::std::string::String) { - self.type_url = v; + pub fn set_type_id(&mut self, v: ::std::string::String) { + self.type_id = v; } // Mutable pointer to the field. // If field is not initialized, it is initialized with default value first. - pub fn mut_type_url(&mut self) -> &mut ::std::string::String { - &mut self.type_url + pub fn mut_type_id(&mut self) -> &mut ::std::string::String { + &mut self.type_id } // Take field - pub fn take_type_url(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.type_url, ::std::string::String::new()) + pub fn take_type_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.type_id, ::std::string::String::new()) } // bytes value = 2; @@ -1607,7 +1773,7 @@ impl ::protobuf::Message for AnyData { let (field_number, wire_type) = is.read_tag_unpack()?; match field_number { 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.type_url)?; + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.type_id)?; }, 2 => { ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.value)?; @@ -1624,8 +1790,8 @@ impl ::protobuf::Message for AnyData { #[allow(unused_variables)] fn compute_size(&self) -> u32 { let mut my_size = 0; - if !self.type_url.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.type_url); + if !self.type_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.type_id); } if !self.value.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.value); @@ -1636,8 +1802,8 @@ impl ::protobuf::Message for AnyData { } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if !self.type_url.is_empty() { - os.write_string(1, &self.type_url)?; + if !self.type_id.is_empty() { + os.write_string(1, &self.type_id)?; } if !self.value.is_empty() { os.write_bytes(2, &self.value)?; @@ -1681,9 +1847,9 @@ impl ::protobuf::Message for AnyData { descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "type_url", - |m: &AnyData| { &m.type_url }, - |m: &mut AnyData| { &mut m.type_url }, + "type_id", + |m: &AnyData| { &m.type_id }, + |m: &mut AnyData| { &mut m.type_id }, )); fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( "value", @@ -1706,7 +1872,7 @@ impl ::protobuf::Message for AnyData { impl ::protobuf::Clear for AnyData { fn clear(&mut self) { - self.type_url.clear(); + self.type_id.clear(); self.value.clear(); self.unknown_fields.clear(); } @@ -2127,25 +2293,25 @@ impl ::protobuf::reflect::ProtobufValue for RepeatedRowOrder { } #[derive(PartialEq,Clone,Default)] -pub struct Row { +pub struct GridRow { // message fields pub id: ::std::string::String, pub grid_id: ::std::string::String, pub modified_time: i64, - pub cell_by_field_id: ::std::collections::HashMap<::std::string::String, Cell>, + pub cell_by_field_id: ::std::collections::HashMap<::std::string::String, GridCell>, // special fields pub unknown_fields: ::protobuf::UnknownFields, pub cached_size: ::protobuf::CachedSize, } -impl<'a> ::std::default::Default for &'a Row { - fn default() -> &'a Row { - ::default_instance() +impl<'a> ::std::default::Default for &'a GridRow { + fn default() -> &'a GridRow { + ::default_instance() } } -impl Row { - pub fn new() -> Row { +impl GridRow { + pub fn new() -> GridRow { ::std::default::Default::default() } @@ -2216,10 +2382,10 @@ impl Row { self.modified_time = v; } - // repeated .Row.CellByFieldIdEntry cell_by_field_id = 4; + // repeated .GridRow.CellByFieldIdEntry cell_by_field_id = 4; - pub fn get_cell_by_field_id(&self) -> &::std::collections::HashMap<::std::string::String, Cell> { + pub fn get_cell_by_field_id(&self) -> &::std::collections::HashMap<::std::string::String, GridCell> { &self.cell_by_field_id } pub fn clear_cell_by_field_id(&mut self) { @@ -2227,22 +2393,22 @@ impl Row { } // Param is passed by value, moved - pub fn set_cell_by_field_id(&mut self, v: ::std::collections::HashMap<::std::string::String, Cell>) { + pub fn set_cell_by_field_id(&mut self, v: ::std::collections::HashMap<::std::string::String, GridCell>) { self.cell_by_field_id = v; } // Mutable pointer to the field. - pub fn mut_cell_by_field_id(&mut self) -> &mut ::std::collections::HashMap<::std::string::String, Cell> { + pub fn mut_cell_by_field_id(&mut self) -> &mut ::std::collections::HashMap<::std::string::String, GridCell> { &mut self.cell_by_field_id } // Take field - pub fn take_cell_by_field_id(&mut self) -> ::std::collections::HashMap<::std::string::String, Cell> { + pub fn take_cell_by_field_id(&mut self) -> ::std::collections::HashMap<::std::string::String, GridCell> { ::std::mem::replace(&mut self.cell_by_field_id, ::std::collections::HashMap::new()) } } -impl ::protobuf::Message for Row { +impl ::protobuf::Message for GridRow { fn is_initialized(&self) -> bool { true } @@ -2265,7 +2431,7 @@ impl ::protobuf::Message for Row { self.modified_time = tmp; }, 4 => { - ::protobuf::rt::read_map_into::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>(wire_type, is, &mut self.cell_by_field_id)?; + ::protobuf::rt::read_map_into::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>(wire_type, is, &mut self.cell_by_field_id)?; }, _ => { ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; @@ -2288,7 +2454,7 @@ impl ::protobuf::Message for Row { if self.modified_time != 0 { my_size += ::protobuf::rt::value_size(3, self.modified_time, ::protobuf::wire_format::WireTypeVarint); } - my_size += ::protobuf::rt::compute_map_size::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>(4, &self.cell_by_field_id); + my_size += ::protobuf::rt::compute_map_size::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>(4, &self.cell_by_field_id); my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); self.cached_size.set(my_size); my_size @@ -2304,7 +2470,7 @@ impl ::protobuf::Message for Row { if self.modified_time != 0 { os.write_int64(3, self.modified_time)?; } - ::protobuf::rt::write_map_with_cached_sizes::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>(4, &self.cell_by_field_id, os)?; + ::protobuf::rt::write_map_with_cached_sizes::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>(4, &self.cell_by_field_id, os)?; os.write_unknown_fields(self.get_unknown_fields())?; ::std::result::Result::Ok(()) } @@ -2335,8 +2501,8 @@ impl ::protobuf::Message for Row { Self::descriptor_static() } - fn new() -> Row { - Row::new() + fn new() -> GridRow { + GridRow::new() } fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { @@ -2345,39 +2511,39 @@ impl ::protobuf::Message for Row { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "id", - |m: &Row| { &m.id }, - |m: &mut Row| { &mut m.id }, + |m: &GridRow| { &m.id }, + |m: &mut GridRow| { &mut m.id }, )); fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "grid_id", - |m: &Row| { &m.grid_id }, - |m: &mut Row| { &mut m.grid_id }, + |m: &GridRow| { &m.grid_id }, + |m: &mut GridRow| { &mut m.grid_id }, )); fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( "modified_time", - |m: &Row| { &m.modified_time }, - |m: &mut Row| { &mut m.modified_time }, + |m: &GridRow| { &m.modified_time }, + |m: &mut GridRow| { &mut m.modified_time }, )); - fields.push(::protobuf::reflect::accessor::make_map_accessor::<_, ::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>( + fields.push(::protobuf::reflect::accessor::make_map_accessor::<_, ::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>( "cell_by_field_id", - |m: &Row| { &m.cell_by_field_id }, - |m: &mut Row| { &mut m.cell_by_field_id }, + |m: &GridRow| { &m.cell_by_field_id }, + |m: &mut GridRow| { &mut m.cell_by_field_id }, )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "Row", + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "GridRow", fields, file_descriptor_proto() ) }) } - fn default_instance() -> &'static Row { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(Row::new) + fn default_instance() -> &'static GridRow { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(GridRow::new) } } -impl ::protobuf::Clear for Row { +impl ::protobuf::Clear for GridRow { fn clear(&mut self) { self.id.clear(); self.grid_id.clear(); @@ -2387,37 +2553,204 @@ impl ::protobuf::Clear for Row { } } -impl ::std::fmt::Debug for Row { +impl ::std::fmt::Debug for GridRow { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } -impl ::protobuf::reflect::ProtobufValue for Row { +impl ::protobuf::reflect::ProtobufValue for GridRow { fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { ::protobuf::reflect::ReflectValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] -pub struct Cell { +pub struct RepeatedRow { // message fields - pub id: ::std::string::String, - pub row_id: ::std::string::String, - pub field_id: ::std::string::String, + pub items: ::protobuf::RepeatedField, // special fields pub unknown_fields: ::protobuf::UnknownFields, pub cached_size: ::protobuf::CachedSize, } -impl<'a> ::std::default::Default for &'a Cell { - fn default() -> &'a Cell { - ::default_instance() +impl<'a> ::std::default::Default for &'a RepeatedRow { + fn default() -> &'a RepeatedRow { + ::default_instance() } } -impl Cell { - pub fn new() -> Cell { +impl RepeatedRow { + pub fn new() -> RepeatedRow { + ::std::default::Default::default() + } + + // repeated .GridRow items = 1; + + + pub fn get_items(&self) -> &[GridRow] { + &self.items + } + pub fn clear_items(&mut self) { + self.items.clear(); + } + + // Param is passed by value, moved + pub fn set_items(&mut self, v: ::protobuf::RepeatedField) { + self.items = v; + } + + // Mutable pointer to the field. + pub fn mut_items(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.items + } + + // Take field + pub fn take_items(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.items, ::protobuf::RepeatedField::new()) + } +} + +impl ::protobuf::Message for RepeatedRow { + fn is_initialized(&self) -> bool { + for v in &self.items { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.items)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + for value in &self.items { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + for v in &self.items { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) + } + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> RepeatedRow { + RepeatedRow::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "items", + |m: &RepeatedRow| { &m.items }, + |m: &mut RepeatedRow| { &mut m.items }, + )); + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "RepeatedRow", + fields, + file_descriptor_proto() + ) + }) + } + + fn default_instance() -> &'static RepeatedRow { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(RepeatedRow::new) + } +} + +impl ::protobuf::Clear for RepeatedRow { + fn clear(&mut self) { + self.items.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RepeatedRow { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RepeatedRow { + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct GridCell { + // message fields + pub id: ::std::string::String, + pub row_id: ::std::string::String, + pub field_id: ::std::string::String, + pub content: ::std::string::String, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a GridCell { + fn default() -> &'a GridCell { + ::default_instance() + } +} + +impl GridCell { + pub fn new() -> GridCell { ::std::default::Default::default() } @@ -2498,198 +2831,8 @@ impl Cell { pub fn take_field_id(&mut self) -> ::std::string::String { ::std::mem::replace(&mut self.field_id, ::std::string::String::new()) } -} -impl ::protobuf::Message for Cell { - fn is_initialized(&self) -> bool { - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.id)?; - }, - 2 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.row_id)?; - }, - 3 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.field_id)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.id.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.id); - } - if !self.row_id.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.row_id); - } - if !self.field_id.is_empty() { - my_size += ::protobuf::rt::string_size(3, &self.field_id); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if !self.id.is_empty() { - os.write_string(1, &self.id)?; - } - if !self.row_id.is_empty() { - os.write_string(2, &self.row_id)?; - } - if !self.field_id.is_empty() { - os.write_string(3, &self.field_id)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> Cell { - Cell::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "id", - |m: &Cell| { &m.id }, - |m: &mut Cell| { &mut m.id }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "row_id", - |m: &Cell| { &m.row_id }, - |m: &mut Cell| { &mut m.row_id }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "field_id", - |m: &Cell| { &m.field_id }, - |m: &mut Cell| { &mut m.field_id }, - )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "Cell", - fields, - file_descriptor_proto() - ) - }) - } - - fn default_instance() -> &'static Cell { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(Cell::new) - } -} - -impl ::protobuf::Clear for Cell { - fn clear(&mut self) { - self.id.clear(); - self.row_id.clear(); - self.field_id.clear(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Cell { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Cell { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct DisplayCell { - // message fields - pub id: ::std::string::String, - pub content: ::std::string::String, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a DisplayCell { - fn default() -> &'a DisplayCell { - ::default_instance() - } -} - -impl DisplayCell { - pub fn new() -> DisplayCell { - ::std::default::Default::default() - } - - // string id = 1; - - - pub fn get_id(&self) -> &str { - &self.id - } - pub fn clear_id(&mut self) { - self.id.clear(); - } - - // Param is passed by value, moved - pub fn set_id(&mut self, v: ::std::string::String) { - self.id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_id(&mut self) -> &mut ::std::string::String { - &mut self.id - } - - // Take field - pub fn take_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.id, ::std::string::String::new()) - } - - // string content = 2; + // string content = 4; pub fn get_content(&self) -> &str { @@ -2716,7 +2859,7 @@ impl DisplayCell { } } -impl ::protobuf::Message for DisplayCell { +impl ::protobuf::Message for GridCell { fn is_initialized(&self) -> bool { true } @@ -2729,6 +2872,12 @@ impl ::protobuf::Message for DisplayCell { ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.id)?; }, 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.row_id)?; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.field_id)?; + }, + 4 => { ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.content)?; }, _ => { @@ -2746,8 +2895,14 @@ impl ::protobuf::Message for DisplayCell { if !self.id.is_empty() { my_size += ::protobuf::rt::string_size(1, &self.id); } + if !self.row_id.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.row_id); + } + if !self.field_id.is_empty() { + my_size += ::protobuf::rt::string_size(3, &self.field_id); + } if !self.content.is_empty() { - my_size += ::protobuf::rt::string_size(2, &self.content); + my_size += ::protobuf::rt::string_size(4, &self.content); } my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); self.cached_size.set(my_size); @@ -2758,8 +2913,14 @@ impl ::protobuf::Message for DisplayCell { if !self.id.is_empty() { os.write_string(1, &self.id)?; } + if !self.row_id.is_empty() { + os.write_string(2, &self.row_id)?; + } + if !self.field_id.is_empty() { + os.write_string(3, &self.field_id)?; + } if !self.content.is_empty() { - os.write_string(2, &self.content)?; + os.write_string(4, &self.content)?; } os.write_unknown_fields(self.get_unknown_fields())?; ::std::result::Result::Ok(()) @@ -2791,8 +2952,8 @@ impl ::protobuf::Message for DisplayCell { Self::descriptor_static() } - fn new() -> DisplayCell { - DisplayCell::new() + fn new() -> GridCell { + GridCell::new() } fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { @@ -2801,259 +2962,55 @@ impl ::protobuf::Message for DisplayCell { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "id", - |m: &DisplayCell| { &m.id }, - |m: &mut DisplayCell| { &mut m.id }, + |m: &GridCell| { &m.id }, + |m: &mut GridCell| { &mut m.id }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "row_id", + |m: &GridCell| { &m.row_id }, + |m: &mut GridCell| { &mut m.row_id }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "field_id", + |m: &GridCell| { &m.field_id }, + |m: &mut GridCell| { &mut m.field_id }, )); fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "content", - |m: &DisplayCell| { &m.content }, - |m: &mut DisplayCell| { &mut m.content }, + |m: &GridCell| { &m.content }, + |m: &mut GridCell| { &mut m.content }, )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "DisplayCell", + ::protobuf::reflect::MessageDescriptor::new_pb_name::( + "GridCell", fields, file_descriptor_proto() ) }) } - fn default_instance() -> &'static DisplayCell { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(DisplayCell::new) + fn default_instance() -> &'static GridCell { + static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; + instance.get(GridCell::new) } } -impl ::protobuf::Clear for DisplayCell { +impl ::protobuf::Clear for GridCell { fn clear(&mut self) { self.id.clear(); + self.row_id.clear(); + self.field_id.clear(); self.content.clear(); self.unknown_fields.clear(); } } -impl ::std::fmt::Debug for DisplayCell { +impl ::std::fmt::Debug for GridCell { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } -impl ::protobuf::reflect::ProtobufValue for DisplayCell { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct RawCell { - // message fields - pub id: ::std::string::String, - pub data: ::protobuf::SingularPtrField, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} - -impl<'a> ::std::default::Default for &'a RawCell { - fn default() -> &'a RawCell { - ::default_instance() - } -} - -impl RawCell { - pub fn new() -> RawCell { - ::std::default::Default::default() - } - - // string id = 1; - - - pub fn get_id(&self) -> &str { - &self.id - } - pub fn clear_id(&mut self) { - self.id.clear(); - } - - // Param is passed by value, moved - pub fn set_id(&mut self, v: ::std::string::String) { - self.id = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_id(&mut self) -> &mut ::std::string::String { - &mut self.id - } - - // Take field - pub fn take_id(&mut self) -> ::std::string::String { - ::std::mem::replace(&mut self.id, ::std::string::String::new()) - } - - // .AnyData data = 2; - - - pub fn get_data(&self) -> &AnyData { - self.data.as_ref().unwrap_or_else(|| ::default_instance()) - } - pub fn clear_data(&mut self) { - self.data.clear(); - } - - pub fn has_data(&self) -> bool { - self.data.is_some() - } - - // Param is passed by value, moved - pub fn set_data(&mut self, v: AnyData) { - self.data = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_data(&mut self) -> &mut AnyData { - if self.data.is_none() { - self.data.set_default(); - } - self.data.as_mut().unwrap() - } - - // Take field - pub fn take_data(&mut self) -> AnyData { - self.data.take().unwrap_or_else(|| AnyData::new()) - } -} - -impl ::protobuf::Message for RawCell { - fn is_initialized(&self) -> bool { - for v in &self.data { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.id)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.data)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.id.is_empty() { - my_size += ::protobuf::rt::string_size(1, &self.id); - } - if let Some(ref v) = self.data.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if !self.id.is_empty() { - os.write_string(1, &self.id)?; - } - if let Some(ref v) = self.data.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> RawCell { - RawCell::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT; - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "id", - |m: &RawCell| { &m.id }, - |m: &mut RawCell| { &mut m.id }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "data", - |m: &RawCell| { &m.data }, - |m: &mut RawCell| { &mut m.data }, - )); - ::protobuf::reflect::MessageDescriptor::new_pb_name::( - "RawCell", - fields, - file_descriptor_proto() - ) - }) - } - - fn default_instance() -> &'static RawCell { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(RawCell::new) - } -} - -impl ::protobuf::Clear for RawCell { - fn clear(&mut self) { - self.id.clear(); - self.data.clear(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for RawCell { - fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for RawCell { +impl ::protobuf::reflect::ProtobufValue for GridCell { fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { ::protobuf::reflect::ReflectValueRef::Message(self) } @@ -3447,37 +3404,37 @@ static file_descriptor_proto_data: &'static [u8] = b"\ \x11.RepeatedRowOrderR\trowOrders\"D\n\nGridFilter\x12\x0e\n\x02id\x18\ \x01\x20\x01(\tR\x02id\x12\x12\n\x04name\x18\x02\x20\x01(\tR\x04name\x12\ \x12\n\x04desc\x18\x03\x20\x01(\tR\x04desc\"7\n\x12RepeatedGridFilter\ - \x12!\n\x05items\x18\x01\x20\x03(\x0b2\x0b.GridFilterR\x05items\"]\n\nFi\ + \x12!\n\x05items\x18\x01\x20\x03(\x0b2\x0b.GridFilterR\x05items\"G\n\nFi\ eldOrder\x12\x19\n\x08field_id\x18\x01\x20\x01(\tR\x07fieldId\x12\x1e\n\ - \nvisibility\x18\x02\x20\x01(\x08R\nvisibility\x12\x14\n\x05width\x18\ - \x03\x20\x01(\x05R\x05width\"7\n\x12RepeatedFieldOrder\x12!\n\x05items\ - \x18\x01\x20\x03(\x0b2\x0b.FieldOrderR\x05items\"\xaf\x01\n\x05Field\x12\ - \x0e\n\x02id\x18\x01\x20\x01(\tR\x02id\x12\x12\n\x04name\x18\x02\x20\x01\ - (\tR\x04name\x12\x12\n\x04desc\x18\x03\x20\x01(\tR\x04desc\x12)\n\nfield\ - _type\x18\x04\x20\x01(\x0e2\n.FieldTypeR\tfieldType\x12\x16\n\x06frozen\ - \x18\x05\x20\x01(\x08R\x06frozen\x12+\n\x0ctype_options\x18\x06\x20\x01(\ - \x0b2\x08.AnyDataR\x0btypeOptions\":\n\x07AnyData\x12\x19\n\x08type_url\ - \x18\x01\x20\x01(\tR\x07typeUrl\x12\x14\n\x05value\x18\x02\x20\x01(\x0cR\ - \x05value\"Z\n\x08RowOrder\x12\x17\n\x07grid_id\x18\x01\x20\x01(\tR\x06g\ - ridId\x12\x15\n\x06row_id\x18\x02\x20\x01(\tR\x05rowId\x12\x1e\n\nvisibi\ - lity\x18\x03\x20\x01(\x08R\nvisibility\"3\n\x10RepeatedRowOrder\x12\x1f\ - \n\x05items\x18\x01\x20\x03(\x0b2\t.RowOrderR\x05items\"\xde\x01\n\x03Ro\ - w\x12\x0e\n\x02id\x18\x01\x20\x01(\tR\x02id\x12\x17\n\x07grid_id\x18\x02\ - \x20\x01(\tR\x06gridId\x12#\n\rmodified_time\x18\x03\x20\x01(\x03R\x0cmo\ - difiedTime\x12@\n\x10cell_by_field_id\x18\x04\x20\x03(\x0b2\x17.Row.Cell\ - ByFieldIdEntryR\rcellByFieldId\x1aG\n\x12CellByFieldIdEntry\x12\x10\n\ - \x03key\x18\x01\x20\x01(\tR\x03key\x12\x1b\n\x05value\x18\x02\x20\x01(\ - \x0b2\x05.CellR\x05value:\x028\x01\"H\n\x04Cell\x12\x0e\n\x02id\x18\x01\ - \x20\x01(\tR\x02id\x12\x15\n\x06row_id\x18\x02\x20\x01(\tR\x05rowId\x12\ - \x19\n\x08field_id\x18\x03\x20\x01(\tR\x07fieldId\"7\n\x0bDisplayCell\ - \x12\x0e\n\x02id\x18\x01\x20\x01(\tR\x02id\x12\x18\n\x07content\x18\x02\ - \x20\x01(\tR\x07content\"7\n\x07RawCell\x12\x0e\n\x02id\x18\x01\x20\x01(\ - \tR\x02id\x12\x1c\n\x04data\x18\x02\x20\x01(\x0b2\x08.AnyDataR\x04data\"\ - '\n\x11CreateGridPayload\x12\x12\n\x04name\x18\x01\x20\x01(\tR\x04name\"\ - \x1e\n\x06GridId\x12\x14\n\x05value\x18\x01\x20\x01(\tR\x05value*d\n\tFi\ - eldType\x12\x0c\n\x08RichText\x10\0\x12\n\n\x06Number\x10\x01\x12\x0c\n\ - \x08DateTime\x10\x02\x12\x10\n\x0cSingleSelect\x10\x03\x12\x0f\n\x0bMult\ - iSelect\x10\x04\x12\x0c\n\x08Checkbox\x10\x05b\x06proto3\ + \nvisibility\x18\x02\x20\x01(\x08R\nvisibility\"7\n\x12RepeatedFieldOrde\ + r\x12!\n\x05items\x18\x01\x20\x03(\x0b2\x0b.FieldOrderR\x05items\"\xc5\ + \x01\n\x05Field\x12\x0e\n\x02id\x18\x01\x20\x01(\tR\x02id\x12\x12\n\x04n\ + ame\x18\x02\x20\x01(\tR\x04name\x12\x12\n\x04desc\x18\x03\x20\x01(\tR\ + \x04desc\x12)\n\nfield_type\x18\x04\x20\x01(\x0e2\n.FieldTypeR\tfieldTyp\ + e\x12\x16\n\x06frozen\x18\x05\x20\x01(\x08R\x06frozen\x12\x14\n\x05width\ + \x18\x06\x20\x01(\x05R\x05width\x12+\n\x0ctype_options\x18\x07\x20\x01(\ + \x0b2\x08.AnyDataR\x0btypeOptions\"-\n\rRepeatedField\x12\x1c\n\x05items\ + \x18\x01\x20\x03(\x0b2\x06.FieldR\x05items\"8\n\x07AnyData\x12\x17\n\x07\ + type_id\x18\x01\x20\x01(\tR\x06typeId\x12\x14\n\x05value\x18\x02\x20\x01\ + (\x0cR\x05value\"Z\n\x08RowOrder\x12\x17\n\x07grid_id\x18\x01\x20\x01(\t\ + R\x06gridId\x12\x15\n\x06row_id\x18\x02\x20\x01(\tR\x05rowId\x12\x1e\n\n\ + visibility\x18\x03\x20\x01(\x08R\nvisibility\"3\n\x10RepeatedRowOrder\ + \x12\x1f\n\x05items\x18\x01\x20\x03(\x0b2\t.RowOrderR\x05items\"\xea\x01\ + \n\x07GridRow\x12\x0e\n\x02id\x18\x01\x20\x01(\tR\x02id\x12\x17\n\x07gri\ + d_id\x18\x02\x20\x01(\tR\x06gridId\x12#\n\rmodified_time\x18\x03\x20\x01\ + (\x03R\x0cmodifiedTime\x12D\n\x10cell_by_field_id\x18\x04\x20\x03(\x0b2\ + \x1b.GridRow.CellByFieldIdEntryR\rcellByFieldId\x1aK\n\x12CellByFieldIdE\ + ntry\x12\x10\n\x03key\x18\x01\x20\x01(\tR\x03key\x12\x1f\n\x05value\x18\ + \x02\x20\x01(\x0b2\t.GridCellR\x05value:\x028\x01\"-\n\x0bRepeatedRow\ + \x12\x1e\n\x05items\x18\x01\x20\x03(\x0b2\x08.GridRowR\x05items\"f\n\x08\ + GridCell\x12\x0e\n\x02id\x18\x01\x20\x01(\tR\x02id\x12\x15\n\x06row_id\ + \x18\x02\x20\x01(\tR\x05rowId\x12\x19\n\x08field_id\x18\x03\x20\x01(\tR\ + \x07fieldId\x12\x18\n\x07content\x18\x04\x20\x01(\tR\x07content\"'\n\x11\ + CreateGridPayload\x12\x12\n\x04name\x18\x01\x20\x01(\tR\x04name\"\x1e\n\ + \x06GridId\x12\x14\n\x05value\x18\x01\x20\x01(\tR\x05value*d\n\tFieldTyp\ + e\x12\x0c\n\x08RichText\x10\0\x12\n\n\x06Number\x10\x01\x12\x0c\n\x08Dat\ + eTime\x10\x02\x12\x10\n\x0cSingleSelect\x10\x03\x12\x0f\n\x0bMultiSelect\ + \x10\x04\x12\x0c\n\x08Checkbox\x10\x05b\x06proto3\ "; static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT; diff --git a/shared-lib/flowy-grid-data-model/src/protobuf/proto/grid.proto b/shared-lib/flowy-grid-data-model/src/protobuf/proto/grid.proto index d1233a3e28..352a54c5c8 100644 --- a/shared-lib/flowy-grid-data-model/src/protobuf/proto/grid.proto +++ b/shared-lib/flowy-grid-data-model/src/protobuf/proto/grid.proto @@ -17,7 +17,6 @@ message RepeatedGridFilter { message FieldOrder { string field_id = 1; bool visibility = 2; - int32 width = 3; } message RepeatedFieldOrder { repeated FieldOrder items = 1; @@ -28,10 +27,14 @@ message Field { string desc = 3; FieldType field_type = 4; bool frozen = 5; - AnyData type_options = 6; + int32 width = 6; + AnyData type_options = 7; +} +message RepeatedField { + repeated Field items = 1; } message AnyData { - string type_url = 1; + string type_id = 1; bytes value = 2; } message RowOrder { @@ -42,24 +45,20 @@ message RowOrder { message RepeatedRowOrder { repeated RowOrder items = 1; } -message Row { +message GridRow { string id = 1; string grid_id = 2; int64 modified_time = 3; - map cell_by_field_id = 4; + map cell_by_field_id = 4; } -message Cell { +message RepeatedRow { + repeated GridRow items = 1; +} +message GridCell { string id = 1; string row_id = 2; string field_id = 3; -} -message DisplayCell { - string id = 1; - string content = 2; -} -message RawCell { - string id = 1; - AnyData data = 2; + string content = 4; } message CreateGridPayload { string name = 1;