mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: deserial cells data from delta error
This commit is contained in:
parent
9d629412c8
commit
2dd5930560
@ -1,8 +1,7 @@
|
||||
import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:flowy_sdk/dispatch/dispatch.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart' show Cell;
|
||||
import 'package:flowy_sdk/protobuf/flowy-grid-data-model/meta.pb.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-grid/cell_entities.pb.dart';
|
||||
|
||||
class CellService {
|
||||
@ -14,7 +13,7 @@ class CellService {
|
||||
required String rowId,
|
||||
required String data,
|
||||
}) {
|
||||
final payload = CellMetaChangeset.create()
|
||||
final payload = CellChangeset.create()
|
||||
..gridId = gridId
|
||||
..fieldId = fieldId
|
||||
..rowId = rowId
|
||||
|
@ -3,7 +3,6 @@ import 'package:equatable/equatable.dart';
|
||||
import 'package:flowy_sdk/dispatch/dispatch.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-grid-data-model/meta.pb.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-grid/field_entities.pb.dart';
|
||||
|
||||
class FieldService {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import 'package:app_flowy/workspace/application/grid/row/row_service.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-grid-data-model/meta.pb.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart' show FieldType;
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'checkbox_cell.dart';
|
||||
import 'date_cell.dart';
|
||||
|
@ -10,7 +10,6 @@ import 'package:flowy_infra_ui/style_widget/text.dart';
|
||||
import 'package:flowy_sdk/log.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-grid-data-model/meta.pb.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-grid/checkbox_type_option.pbserver.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-grid/text_type_option.pb.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -1,5 +1,4 @@
|
||||
|
||||
import 'package:flowy_sdk/protobuf/flowy-grid-data-model/meta.pb.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart' show FieldType;
|
||||
import 'package:app_flowy/generated/locale_keys.g.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
|
||||
|
@ -6,7 +6,7 @@ import 'package:flowy_infra_ui/style_widget/button.dart';
|
||||
import 'package:flowy_infra_ui/style_widget/scrolling/styled_list.dart';
|
||||
import 'package:flowy_infra_ui/style_widget/text.dart';
|
||||
import 'package:flowy_infra_ui/widget/spacing.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-grid-data-model/meta.pb.dart';
|
||||
import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart' show FieldType;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'field_type_extension.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
@ -291,7 +291,7 @@ class GridEventGetCell {
|
||||
}
|
||||
|
||||
class GridEventUpdateCell {
|
||||
CellMetaChangeset request;
|
||||
CellChangeset request;
|
||||
GridEventUpdateCell(this.request);
|
||||
|
||||
Future<Either<Unit, FlowyError>> send() {
|
||||
|
@ -9,7 +9,9 @@ import 'dart:core' as $core;
|
||||
|
||||
import 'package:protobuf/protobuf.dart' as $pb;
|
||||
|
||||
import 'meta.pbenum.dart' as $0;
|
||||
import 'grid.pbenum.dart';
|
||||
|
||||
export 'grid.pbenum.dart';
|
||||
|
||||
class Grid extends $pb.GeneratedMessage {
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'Grid', createEmptyInstance: create)
|
||||
@ -79,7 +81,7 @@ class Field extends $pb.GeneratedMessage {
|
||||
..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') ? '' : 'desc')
|
||||
..e<$0.FieldType>(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldType', $pb.PbFieldType.OE, defaultOrMaker: $0.FieldType.RichText, valueOf: $0.FieldType.valueOf, enumValues: $0.FieldType.values)
|
||||
..e<FieldType>(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')
|
||||
..aOB(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'visibility')
|
||||
..a<$core.int>(7, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'width', $pb.PbFieldType.O3)
|
||||
@ -91,7 +93,7 @@ class Field extends $pb.GeneratedMessage {
|
||||
$core.String? id,
|
||||
$core.String? name,
|
||||
$core.String? desc,
|
||||
$0.FieldType? fieldType,
|
||||
FieldType? fieldType,
|
||||
$core.bool? frozen,
|
||||
$core.bool? visibility,
|
||||
$core.int? width,
|
||||
@ -169,9 +171,9 @@ class Field extends $pb.GeneratedMessage {
|
||||
void clearDesc() => clearField(3);
|
||||
|
||||
@$pb.TagNumber(4)
|
||||
$0.FieldType get fieldType => $_getN(3);
|
||||
FieldType get fieldType => $_getN(3);
|
||||
@$pb.TagNumber(4)
|
||||
set fieldType($0.FieldType v) { setField(4, v); }
|
||||
set fieldType(FieldType v) { setField(4, v); }
|
||||
@$pb.TagNumber(4)
|
||||
$core.bool hasFieldType() => $_has(3);
|
||||
@$pb.TagNumber(4)
|
||||
@ -266,7 +268,7 @@ class GetEditFieldContextPayload extends $pb.GeneratedMessage {
|
||||
..oo(0, [2])
|
||||
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridId')
|
||||
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldId')
|
||||
..e<$0.FieldType>(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldType', $pb.PbFieldType.OE, defaultOrMaker: $0.FieldType.RichText, valueOf: $0.FieldType.valueOf, enumValues: $0.FieldType.values)
|
||||
..e<FieldType>(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldType', $pb.PbFieldType.OE, defaultOrMaker: FieldType.RichText, valueOf: FieldType.valueOf, enumValues: FieldType.values)
|
||||
..hasRequiredFields = false
|
||||
;
|
||||
|
||||
@ -274,7 +276,7 @@ class GetEditFieldContextPayload extends $pb.GeneratedMessage {
|
||||
factory GetEditFieldContextPayload({
|
||||
$core.String? gridId,
|
||||
$core.String? fieldId,
|
||||
$0.FieldType? fieldType,
|
||||
FieldType? fieldType,
|
||||
}) {
|
||||
final _result = create();
|
||||
if (gridId != null) {
|
||||
@ -331,9 +333,9 @@ class GetEditFieldContextPayload extends $pb.GeneratedMessage {
|
||||
void clearFieldId() => clearField(2);
|
||||
|
||||
@$pb.TagNumber(3)
|
||||
$0.FieldType get fieldType => $_getN(2);
|
||||
FieldType get fieldType => $_getN(2);
|
||||
@$pb.TagNumber(3)
|
||||
set fieldType($0.FieldType v) { setField(3, v); }
|
||||
set fieldType(FieldType v) { setField(3, v); }
|
||||
@$pb.TagNumber(3)
|
||||
$core.bool hasFieldType() => $_has(2);
|
||||
@$pb.TagNumber(3)
|
||||
@ -344,7 +346,7 @@ class EditFieldPayload extends $pb.GeneratedMessage {
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'EditFieldPayload', createEmptyInstance: create)
|
||||
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridId')
|
||||
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldId')
|
||||
..e<$0.FieldType>(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldType', $pb.PbFieldType.OE, defaultOrMaker: $0.FieldType.RichText, valueOf: $0.FieldType.valueOf, enumValues: $0.FieldType.values)
|
||||
..e<FieldType>(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldType', $pb.PbFieldType.OE, defaultOrMaker: FieldType.RichText, valueOf: FieldType.valueOf, enumValues: FieldType.values)
|
||||
..hasRequiredFields = false
|
||||
;
|
||||
|
||||
@ -352,7 +354,7 @@ class EditFieldPayload extends $pb.GeneratedMessage {
|
||||
factory EditFieldPayload({
|
||||
$core.String? gridId,
|
||||
$core.String? fieldId,
|
||||
$0.FieldType? fieldType,
|
||||
FieldType? fieldType,
|
||||
}) {
|
||||
final _result = create();
|
||||
if (gridId != null) {
|
||||
@ -406,9 +408,9 @@ class EditFieldPayload extends $pb.GeneratedMessage {
|
||||
void clearFieldId() => clearField(2);
|
||||
|
||||
@$pb.TagNumber(3)
|
||||
$0.FieldType get fieldType => $_getN(2);
|
||||
FieldType get fieldType => $_getN(2);
|
||||
@$pb.TagNumber(3)
|
||||
set fieldType($0.FieldType v) { setField(3, v); }
|
||||
set fieldType(FieldType v) { setField(3, v); }
|
||||
@$pb.TagNumber(3)
|
||||
$core.bool hasFieldType() => $_has(2);
|
||||
@$pb.TagNumber(3)
|
||||
@ -1698,3 +1700,355 @@ class QueryGridBlocksPayload extends $pb.GeneratedMessage {
|
||||
$core.List<GridBlockOrder> get blockOrders => $_getList(1);
|
||||
}
|
||||
|
||||
enum FieldChangesetPayload_OneOfName {
|
||||
name,
|
||||
notSet
|
||||
}
|
||||
|
||||
enum FieldChangesetPayload_OneOfDesc {
|
||||
desc,
|
||||
notSet
|
||||
}
|
||||
|
||||
enum FieldChangesetPayload_OneOfFieldType {
|
||||
fieldType,
|
||||
notSet
|
||||
}
|
||||
|
||||
enum FieldChangesetPayload_OneOfFrozen {
|
||||
frozen,
|
||||
notSet
|
||||
}
|
||||
|
||||
enum FieldChangesetPayload_OneOfVisibility {
|
||||
visibility,
|
||||
notSet
|
||||
}
|
||||
|
||||
enum FieldChangesetPayload_OneOfWidth {
|
||||
width,
|
||||
notSet
|
||||
}
|
||||
|
||||
enum FieldChangesetPayload_OneOfTypeOptionData {
|
||||
typeOptionData,
|
||||
notSet
|
||||
}
|
||||
|
||||
class FieldChangesetPayload extends $pb.GeneratedMessage {
|
||||
static const $core.Map<$core.int, FieldChangesetPayload_OneOfName> _FieldChangesetPayload_OneOfNameByTag = {
|
||||
3 : FieldChangesetPayload_OneOfName.name,
|
||||
0 : FieldChangesetPayload_OneOfName.notSet
|
||||
};
|
||||
static const $core.Map<$core.int, FieldChangesetPayload_OneOfDesc> _FieldChangesetPayload_OneOfDescByTag = {
|
||||
4 : FieldChangesetPayload_OneOfDesc.desc,
|
||||
0 : FieldChangesetPayload_OneOfDesc.notSet
|
||||
};
|
||||
static const $core.Map<$core.int, FieldChangesetPayload_OneOfFieldType> _FieldChangesetPayload_OneOfFieldTypeByTag = {
|
||||
5 : FieldChangesetPayload_OneOfFieldType.fieldType,
|
||||
0 : FieldChangesetPayload_OneOfFieldType.notSet
|
||||
};
|
||||
static const $core.Map<$core.int, FieldChangesetPayload_OneOfFrozen> _FieldChangesetPayload_OneOfFrozenByTag = {
|
||||
6 : FieldChangesetPayload_OneOfFrozen.frozen,
|
||||
0 : FieldChangesetPayload_OneOfFrozen.notSet
|
||||
};
|
||||
static const $core.Map<$core.int, FieldChangesetPayload_OneOfVisibility> _FieldChangesetPayload_OneOfVisibilityByTag = {
|
||||
7 : FieldChangesetPayload_OneOfVisibility.visibility,
|
||||
0 : FieldChangesetPayload_OneOfVisibility.notSet
|
||||
};
|
||||
static const $core.Map<$core.int, FieldChangesetPayload_OneOfWidth> _FieldChangesetPayload_OneOfWidthByTag = {
|
||||
8 : FieldChangesetPayload_OneOfWidth.width,
|
||||
0 : FieldChangesetPayload_OneOfWidth.notSet
|
||||
};
|
||||
static const $core.Map<$core.int, FieldChangesetPayload_OneOfTypeOptionData> _FieldChangesetPayload_OneOfTypeOptionDataByTag = {
|
||||
9 : FieldChangesetPayload_OneOfTypeOptionData.typeOptionData,
|
||||
0 : FieldChangesetPayload_OneOfTypeOptionData.notSet
|
||||
};
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'FieldChangesetPayload', createEmptyInstance: create)
|
||||
..oo(0, [3])
|
||||
..oo(1, [4])
|
||||
..oo(2, [5])
|
||||
..oo(3, [6])
|
||||
..oo(4, [7])
|
||||
..oo(5, [8])
|
||||
..oo(6, [9])
|
||||
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldId')
|
||||
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridId')
|
||||
..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name')
|
||||
..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'desc')
|
||||
..e<FieldType>(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldType', $pb.PbFieldType.OE, defaultOrMaker: FieldType.RichText, valueOf: FieldType.valueOf, enumValues: FieldType.values)
|
||||
..aOB(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'frozen')
|
||||
..aOB(7, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'visibility')
|
||||
..a<$core.int>(8, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'width', $pb.PbFieldType.O3)
|
||||
..a<$core.List<$core.int>>(9, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'typeOptionData', $pb.PbFieldType.OY)
|
||||
..hasRequiredFields = false
|
||||
;
|
||||
|
||||
FieldChangesetPayload._() : super();
|
||||
factory FieldChangesetPayload({
|
||||
$core.String? fieldId,
|
||||
$core.String? gridId,
|
||||
$core.String? name,
|
||||
$core.String? desc,
|
||||
FieldType? fieldType,
|
||||
$core.bool? frozen,
|
||||
$core.bool? visibility,
|
||||
$core.int? width,
|
||||
$core.List<$core.int>? typeOptionData,
|
||||
}) {
|
||||
final _result = create();
|
||||
if (fieldId != null) {
|
||||
_result.fieldId = fieldId;
|
||||
}
|
||||
if (gridId != null) {
|
||||
_result.gridId = gridId;
|
||||
}
|
||||
if (name != null) {
|
||||
_result.name = name;
|
||||
}
|
||||
if (desc != null) {
|
||||
_result.desc = desc;
|
||||
}
|
||||
if (fieldType != null) {
|
||||
_result.fieldType = fieldType;
|
||||
}
|
||||
if (frozen != null) {
|
||||
_result.frozen = frozen;
|
||||
}
|
||||
if (visibility != null) {
|
||||
_result.visibility = visibility;
|
||||
}
|
||||
if (width != null) {
|
||||
_result.width = width;
|
||||
}
|
||||
if (typeOptionData != null) {
|
||||
_result.typeOptionData = typeOptionData;
|
||||
}
|
||||
return _result;
|
||||
}
|
||||
factory FieldChangesetPayload.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
|
||||
factory FieldChangesetPayload.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')
|
||||
FieldChangesetPayload clone() => FieldChangesetPayload()..mergeFromMessage(this);
|
||||
@$core.Deprecated(
|
||||
'Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
|
||||
'Will be removed in next major version')
|
||||
FieldChangesetPayload copyWith(void Function(FieldChangesetPayload) updates) => super.copyWith((message) => updates(message as FieldChangesetPayload)) as FieldChangesetPayload; // ignore: deprecated_member_use
|
||||
$pb.BuilderInfo get info_ => _i;
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static FieldChangesetPayload create() => FieldChangesetPayload._();
|
||||
FieldChangesetPayload createEmptyInstance() => create();
|
||||
static $pb.PbList<FieldChangesetPayload> createRepeated() => $pb.PbList<FieldChangesetPayload>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static FieldChangesetPayload getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<FieldChangesetPayload>(create);
|
||||
static FieldChangesetPayload? _defaultInstance;
|
||||
|
||||
FieldChangesetPayload_OneOfName whichOneOfName() => _FieldChangesetPayload_OneOfNameByTag[$_whichOneof(0)]!;
|
||||
void clearOneOfName() => clearField($_whichOneof(0));
|
||||
|
||||
FieldChangesetPayload_OneOfDesc whichOneOfDesc() => _FieldChangesetPayload_OneOfDescByTag[$_whichOneof(1)]!;
|
||||
void clearOneOfDesc() => clearField($_whichOneof(1));
|
||||
|
||||
FieldChangesetPayload_OneOfFieldType whichOneOfFieldType() => _FieldChangesetPayload_OneOfFieldTypeByTag[$_whichOneof(2)]!;
|
||||
void clearOneOfFieldType() => clearField($_whichOneof(2));
|
||||
|
||||
FieldChangesetPayload_OneOfFrozen whichOneOfFrozen() => _FieldChangesetPayload_OneOfFrozenByTag[$_whichOneof(3)]!;
|
||||
void clearOneOfFrozen() => clearField($_whichOneof(3));
|
||||
|
||||
FieldChangesetPayload_OneOfVisibility whichOneOfVisibility() => _FieldChangesetPayload_OneOfVisibilityByTag[$_whichOneof(4)]!;
|
||||
void clearOneOfVisibility() => clearField($_whichOneof(4));
|
||||
|
||||
FieldChangesetPayload_OneOfWidth whichOneOfWidth() => _FieldChangesetPayload_OneOfWidthByTag[$_whichOneof(5)]!;
|
||||
void clearOneOfWidth() => clearField($_whichOneof(5));
|
||||
|
||||
FieldChangesetPayload_OneOfTypeOptionData whichOneOfTypeOptionData() => _FieldChangesetPayload_OneOfTypeOptionDataByTag[$_whichOneof(6)]!;
|
||||
void clearOneOfTypeOptionData() => clearField($_whichOneof(6));
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
$core.String get fieldId => $_getSZ(0);
|
||||
@$pb.TagNumber(1)
|
||||
set fieldId($core.String v) { $_setString(0, v); }
|
||||
@$pb.TagNumber(1)
|
||||
$core.bool hasFieldId() => $_has(0);
|
||||
@$pb.TagNumber(1)
|
||||
void clearFieldId() => clearField(1);
|
||||
|
||||
@$pb.TagNumber(2)
|
||||
$core.String get gridId => $_getSZ(1);
|
||||
@$pb.TagNumber(2)
|
||||
set gridId($core.String v) { $_setString(1, v); }
|
||||
@$pb.TagNumber(2)
|
||||
$core.bool hasGridId() => $_has(1);
|
||||
@$pb.TagNumber(2)
|
||||
void clearGridId() => clearField(2);
|
||||
|
||||
@$pb.TagNumber(3)
|
||||
$core.String get name => $_getSZ(2);
|
||||
@$pb.TagNumber(3)
|
||||
set name($core.String v) { $_setString(2, v); }
|
||||
@$pb.TagNumber(3)
|
||||
$core.bool hasName() => $_has(2);
|
||||
@$pb.TagNumber(3)
|
||||
void clearName() => clearField(3);
|
||||
|
||||
@$pb.TagNumber(4)
|
||||
$core.String get desc => $_getSZ(3);
|
||||
@$pb.TagNumber(4)
|
||||
set desc($core.String v) { $_setString(3, v); }
|
||||
@$pb.TagNumber(4)
|
||||
$core.bool hasDesc() => $_has(3);
|
||||
@$pb.TagNumber(4)
|
||||
void clearDesc() => clearField(4);
|
||||
|
||||
@$pb.TagNumber(5)
|
||||
FieldType get fieldType => $_getN(4);
|
||||
@$pb.TagNumber(5)
|
||||
set fieldType(FieldType v) { setField(5, v); }
|
||||
@$pb.TagNumber(5)
|
||||
$core.bool hasFieldType() => $_has(4);
|
||||
@$pb.TagNumber(5)
|
||||
void clearFieldType() => clearField(5);
|
||||
|
||||
@$pb.TagNumber(6)
|
||||
$core.bool get frozen => $_getBF(5);
|
||||
@$pb.TagNumber(6)
|
||||
set frozen($core.bool v) { $_setBool(5, v); }
|
||||
@$pb.TagNumber(6)
|
||||
$core.bool hasFrozen() => $_has(5);
|
||||
@$pb.TagNumber(6)
|
||||
void clearFrozen() => clearField(6);
|
||||
|
||||
@$pb.TagNumber(7)
|
||||
$core.bool get visibility => $_getBF(6);
|
||||
@$pb.TagNumber(7)
|
||||
set visibility($core.bool v) { $_setBool(6, v); }
|
||||
@$pb.TagNumber(7)
|
||||
$core.bool hasVisibility() => $_has(6);
|
||||
@$pb.TagNumber(7)
|
||||
void clearVisibility() => clearField(7);
|
||||
|
||||
@$pb.TagNumber(8)
|
||||
$core.int get width => $_getIZ(7);
|
||||
@$pb.TagNumber(8)
|
||||
set width($core.int v) { $_setSignedInt32(7, v); }
|
||||
@$pb.TagNumber(8)
|
||||
$core.bool hasWidth() => $_has(7);
|
||||
@$pb.TagNumber(8)
|
||||
void clearWidth() => clearField(8);
|
||||
|
||||
@$pb.TagNumber(9)
|
||||
$core.List<$core.int> get typeOptionData => $_getN(8);
|
||||
@$pb.TagNumber(9)
|
||||
set typeOptionData($core.List<$core.int> v) { $_setBytes(8, v); }
|
||||
@$pb.TagNumber(9)
|
||||
$core.bool hasTypeOptionData() => $_has(8);
|
||||
@$pb.TagNumber(9)
|
||||
void clearTypeOptionData() => clearField(9);
|
||||
}
|
||||
|
||||
enum CellChangeset_OneOfData {
|
||||
data,
|
||||
notSet
|
||||
}
|
||||
|
||||
class CellChangeset extends $pb.GeneratedMessage {
|
||||
static const $core.Map<$core.int, CellChangeset_OneOfData> _CellChangeset_OneOfDataByTag = {
|
||||
4 : CellChangeset_OneOfData.data,
|
||||
0 : CellChangeset_OneOfData.notSet
|
||||
};
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'CellChangeset', createEmptyInstance: create)
|
||||
..oo(0, [4])
|
||||
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridId')
|
||||
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'rowId')
|
||||
..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldId')
|
||||
..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'data')
|
||||
..hasRequiredFields = false
|
||||
;
|
||||
|
||||
CellChangeset._() : super();
|
||||
factory CellChangeset({
|
||||
$core.String? gridId,
|
||||
$core.String? rowId,
|
||||
$core.String? fieldId,
|
||||
$core.String? data,
|
||||
}) {
|
||||
final _result = create();
|
||||
if (gridId != null) {
|
||||
_result.gridId = gridId;
|
||||
}
|
||||
if (rowId != null) {
|
||||
_result.rowId = rowId;
|
||||
}
|
||||
if (fieldId != null) {
|
||||
_result.fieldId = fieldId;
|
||||
}
|
||||
if (data != null) {
|
||||
_result.data = data;
|
||||
}
|
||||
return _result;
|
||||
}
|
||||
factory CellChangeset.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
|
||||
factory CellChangeset.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')
|
||||
CellChangeset clone() => CellChangeset()..mergeFromMessage(this);
|
||||
@$core.Deprecated(
|
||||
'Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
|
||||
'Will be removed in next major version')
|
||||
CellChangeset copyWith(void Function(CellChangeset) updates) => super.copyWith((message) => updates(message as CellChangeset)) as CellChangeset; // ignore: deprecated_member_use
|
||||
$pb.BuilderInfo get info_ => _i;
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static CellChangeset create() => CellChangeset._();
|
||||
CellChangeset createEmptyInstance() => create();
|
||||
static $pb.PbList<CellChangeset> createRepeated() => $pb.PbList<CellChangeset>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static CellChangeset getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<CellChangeset>(create);
|
||||
static CellChangeset? _defaultInstance;
|
||||
|
||||
CellChangeset_OneOfData whichOneOfData() => _CellChangeset_OneOfDataByTag[$_whichOneof(0)]!;
|
||||
void clearOneOfData() => clearField($_whichOneof(0));
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
$core.String get gridId => $_getSZ(0);
|
||||
@$pb.TagNumber(1)
|
||||
set gridId($core.String v) { $_setString(0, v); }
|
||||
@$pb.TagNumber(1)
|
||||
$core.bool hasGridId() => $_has(0);
|
||||
@$pb.TagNumber(1)
|
||||
void clearGridId() => clearField(1);
|
||||
|
||||
@$pb.TagNumber(2)
|
||||
$core.String get rowId => $_getSZ(1);
|
||||
@$pb.TagNumber(2)
|
||||
set rowId($core.String v) { $_setString(1, v); }
|
||||
@$pb.TagNumber(2)
|
||||
$core.bool hasRowId() => $_has(1);
|
||||
@$pb.TagNumber(2)
|
||||
void clearRowId() => clearField(2);
|
||||
|
||||
@$pb.TagNumber(3)
|
||||
$core.String get fieldId => $_getSZ(2);
|
||||
@$pb.TagNumber(3)
|
||||
set fieldId($core.String v) { $_setString(2, v); }
|
||||
@$pb.TagNumber(3)
|
||||
$core.bool hasFieldId() => $_has(2);
|
||||
@$pb.TagNumber(3)
|
||||
void clearFieldId() => clearField(3);
|
||||
|
||||
@$pb.TagNumber(4)
|
||||
$core.String get data => $_getSZ(3);
|
||||
@$pb.TagNumber(4)
|
||||
set data($core.String v) { $_setString(3, v); }
|
||||
@$pb.TagNumber(4)
|
||||
$core.bool hasData() => $_has(3);
|
||||
@$pb.TagNumber(4)
|
||||
void clearData() => clearField(4);
|
||||
}
|
||||
|
||||
|
@ -5,3 +5,30 @@
|
||||
// @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 FieldType extends $pb.ProtobufEnum {
|
||||
static const FieldType RichText = FieldType._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'RichText');
|
||||
static const FieldType Number = FieldType._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Number');
|
||||
static const FieldType DateTime = FieldType._(2, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'DateTime');
|
||||
static const FieldType SingleSelect = FieldType._(3, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'SingleSelect');
|
||||
static const FieldType MultiSelect = FieldType._(4, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'MultiSelect');
|
||||
static const FieldType Checkbox = FieldType._(5, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Checkbox');
|
||||
|
||||
static const $core.List<FieldType> values = <FieldType> [
|
||||
RichText,
|
||||
Number,
|
||||
DateTime,
|
||||
SingleSelect,
|
||||
MultiSelect,
|
||||
Checkbox,
|
||||
];
|
||||
|
||||
static final $core.Map<$core.int, FieldType> _byValue = $pb.ProtobufEnum.initByValue(values);
|
||||
static FieldType? valueOf($core.int value) => _byValue[value];
|
||||
|
||||
const FieldType._($core.int v, $core.String n) : super(v, n);
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,21 @@
|
||||
import 'dart:core' as $core;
|
||||
import 'dart:convert' as $convert;
|
||||
import 'dart:typed_data' as $typed_data;
|
||||
@$core.Deprecated('Use fieldTypeDescriptor instead')
|
||||
const FieldType$json = const {
|
||||
'1': 'FieldType',
|
||||
'2': const [
|
||||
const {'1': 'RichText', '2': 0},
|
||||
const {'1': 'Number', '2': 1},
|
||||
const {'1': 'DateTime', '2': 2},
|
||||
const {'1': 'SingleSelect', '2': 3},
|
||||
const {'1': 'MultiSelect', '2': 4},
|
||||
const {'1': 'Checkbox', '2': 5},
|
||||
],
|
||||
};
|
||||
|
||||
/// Descriptor for `FieldType`. Decode as a `google.protobuf.EnumDescriptorProto`.
|
||||
final $typed_data.Uint8List fieldTypeDescriptor = $convert.base64Decode('CglGaWVsZFR5cGUSDAoIUmljaFRleHQQABIKCgZOdW1iZXIQARIMCghEYXRlVGltZRACEhAKDFNpbmdsZVNlbGVjdBADEg8KC011bHRpU2VsZWN0EAQSDAoIQ2hlY2tib3gQBQ==');
|
||||
@$core.Deprecated('Use gridDescriptor instead')
|
||||
const Grid$json = const {
|
||||
'1': 'Grid',
|
||||
@ -328,3 +343,46 @@ const QueryGridBlocksPayload$json = const {
|
||||
|
||||
/// Descriptor for `QueryGridBlocksPayload`. Decode as a `google.protobuf.DescriptorProto`.
|
||||
final $typed_data.Uint8List queryGridBlocksPayloadDescriptor = $convert.base64Decode('ChZRdWVyeUdyaWRCbG9ja3NQYXlsb2FkEhcKB2dyaWRfaWQYASABKAlSBmdyaWRJZBIyCgxibG9ja19vcmRlcnMYAiADKAsyDy5HcmlkQmxvY2tPcmRlclILYmxvY2tPcmRlcnM=');
|
||||
@$core.Deprecated('Use fieldChangesetPayloadDescriptor instead')
|
||||
const FieldChangesetPayload$json = const {
|
||||
'1': 'FieldChangesetPayload',
|
||||
'2': const [
|
||||
const {'1': 'field_id', '3': 1, '4': 1, '5': 9, '10': 'fieldId'},
|
||||
const {'1': 'grid_id', '3': 2, '4': 1, '5': 9, '10': 'gridId'},
|
||||
const {'1': 'name', '3': 3, '4': 1, '5': 9, '9': 0, '10': 'name'},
|
||||
const {'1': 'desc', '3': 4, '4': 1, '5': 9, '9': 1, '10': 'desc'},
|
||||
const {'1': 'field_type', '3': 5, '4': 1, '5': 14, '6': '.FieldType', '9': 2, '10': 'fieldType'},
|
||||
const {'1': 'frozen', '3': 6, '4': 1, '5': 8, '9': 3, '10': 'frozen'},
|
||||
const {'1': 'visibility', '3': 7, '4': 1, '5': 8, '9': 4, '10': 'visibility'},
|
||||
const {'1': 'width', '3': 8, '4': 1, '5': 5, '9': 5, '10': 'width'},
|
||||
const {'1': 'type_option_data', '3': 9, '4': 1, '5': 12, '9': 6, '10': 'typeOptionData'},
|
||||
],
|
||||
'8': const [
|
||||
const {'1': 'one_of_name'},
|
||||
const {'1': 'one_of_desc'},
|
||||
const {'1': 'one_of_field_type'},
|
||||
const {'1': 'one_of_frozen'},
|
||||
const {'1': 'one_of_visibility'},
|
||||
const {'1': 'one_of_width'},
|
||||
const {'1': 'one_of_type_option_data'},
|
||||
],
|
||||
};
|
||||
|
||||
/// Descriptor for `FieldChangesetPayload`. Decode as a `google.protobuf.DescriptorProto`.
|
||||
final $typed_data.Uint8List fieldChangesetPayloadDescriptor = $convert.base64Decode('ChVGaWVsZENoYW5nZXNldFBheWxvYWQSGQoIZmllbGRfaWQYASABKAlSB2ZpZWxkSWQSFwoHZ3JpZF9pZBgCIAEoCVIGZ3JpZElkEhQKBG5hbWUYAyABKAlIAFIEbmFtZRIUCgRkZXNjGAQgASgJSAFSBGRlc2MSKwoKZmllbGRfdHlwZRgFIAEoDjIKLkZpZWxkVHlwZUgCUglmaWVsZFR5cGUSGAoGZnJvemVuGAYgASgISANSBmZyb3plbhIgCgp2aXNpYmlsaXR5GAcgASgISARSCnZpc2liaWxpdHkSFgoFd2lkdGgYCCABKAVIBVIFd2lkdGgSKgoQdHlwZV9vcHRpb25fZGF0YRgJIAEoDEgGUg50eXBlT3B0aW9uRGF0YUINCgtvbmVfb2ZfbmFtZUINCgtvbmVfb2ZfZGVzY0ITChFvbmVfb2ZfZmllbGRfdHlwZUIPCg1vbmVfb2ZfZnJvemVuQhMKEW9uZV9vZl92aXNpYmlsaXR5Qg4KDG9uZV9vZl93aWR0aEIZChdvbmVfb2ZfdHlwZV9vcHRpb25fZGF0YQ==');
|
||||
@$core.Deprecated('Use cellChangesetDescriptor instead')
|
||||
const CellChangeset$json = const {
|
||||
'1': 'CellChangeset',
|
||||
'2': const [
|
||||
const {'1': 'grid_id', '3': 1, '4': 1, '5': 9, '10': 'gridId'},
|
||||
const {'1': 'row_id', '3': 2, '4': 1, '5': 9, '10': 'rowId'},
|
||||
const {'1': 'field_id', '3': 3, '4': 1, '5': 9, '10': 'fieldId'},
|
||||
const {'1': 'data', '3': 4, '4': 1, '5': 9, '9': 0, '10': 'data'},
|
||||
],
|
||||
'8': const [
|
||||
const {'1': 'one_of_data'},
|
||||
],
|
||||
};
|
||||
|
||||
/// Descriptor for `CellChangeset`. Decode as a `google.protobuf.DescriptorProto`.
|
||||
final $typed_data.Uint8List cellChangesetDescriptor = $convert.base64Decode('Cg1DZWxsQ2hhbmdlc2V0EhcKB2dyaWRfaWQYASABKAlSBmdyaWRJZBIVCgZyb3dfaWQYAiABKAlSBXJvd0lkEhkKCGZpZWxkX2lkGAMgASgJUgdmaWVsZElkEhQKBGRhdGEYBCABKAlIAFIEZGF0YUINCgtvbmVfb2ZfZGF0YQ==');
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,34 +0,0 @@
|
||||
///
|
||||
// Generated code. Do not modify.
|
||||
// source: meta.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 FieldType extends $pb.ProtobufEnum {
|
||||
static const FieldType RichText = FieldType._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'RichText');
|
||||
static const FieldType Number = FieldType._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Number');
|
||||
static const FieldType DateTime = FieldType._(2, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'DateTime');
|
||||
static const FieldType SingleSelect = FieldType._(3, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'SingleSelect');
|
||||
static const FieldType MultiSelect = FieldType._(4, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'MultiSelect');
|
||||
static const FieldType Checkbox = FieldType._(5, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Checkbox');
|
||||
|
||||
static const $core.List<FieldType> values = <FieldType> [
|
||||
RichText,
|
||||
Number,
|
||||
DateTime,
|
||||
SingleSelect,
|
||||
MultiSelect,
|
||||
Checkbox,
|
||||
];
|
||||
|
||||
static final $core.Map<$core.int, FieldType> _byValue = $pb.ProtobufEnum.initByValue(values);
|
||||
static FieldType? valueOf($core.int value) => _byValue[value];
|
||||
|
||||
const FieldType._($core.int v, $core.String n) : super(v, n);
|
||||
}
|
||||
|
@ -1,217 +0,0 @@
|
||||
///
|
||||
// Generated code. Do not modify.
|
||||
// source: meta.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 fieldTypeDescriptor instead')
|
||||
const FieldType$json = const {
|
||||
'1': 'FieldType',
|
||||
'2': const [
|
||||
const {'1': 'RichText', '2': 0},
|
||||
const {'1': 'Number', '2': 1},
|
||||
const {'1': 'DateTime', '2': 2},
|
||||
const {'1': 'SingleSelect', '2': 3},
|
||||
const {'1': 'MultiSelect', '2': 4},
|
||||
const {'1': 'Checkbox', '2': 5},
|
||||
],
|
||||
};
|
||||
|
||||
/// Descriptor for `FieldType`. Decode as a `google.protobuf.EnumDescriptorProto`.
|
||||
final $typed_data.Uint8List fieldTypeDescriptor = $convert.base64Decode('CglGaWVsZFR5cGUSDAoIUmljaFRleHQQABIKCgZOdW1iZXIQARIMCghEYXRlVGltZRACEhAKDFNpbmdsZVNlbGVjdBADEg8KC011bHRpU2VsZWN0EAQSDAoIQ2hlY2tib3gQBQ==');
|
||||
@$core.Deprecated('Use gridMetaDescriptor instead')
|
||||
const GridMeta$json = const {
|
||||
'1': 'GridMeta',
|
||||
'2': const [
|
||||
const {'1': 'grid_id', '3': 1, '4': 1, '5': 9, '10': 'gridId'},
|
||||
const {'1': 'fields', '3': 2, '4': 3, '5': 11, '6': '.FieldMeta', '10': 'fields'},
|
||||
const {'1': 'blocks', '3': 3, '4': 3, '5': 11, '6': '.GridBlockMeta', '10': 'blocks'},
|
||||
],
|
||||
};
|
||||
|
||||
/// Descriptor for `GridMeta`. Decode as a `google.protobuf.DescriptorProto`.
|
||||
final $typed_data.Uint8List gridMetaDescriptor = $convert.base64Decode('CghHcmlkTWV0YRIXCgdncmlkX2lkGAEgASgJUgZncmlkSWQSIgoGZmllbGRzGAIgAygLMgouRmllbGRNZXRhUgZmaWVsZHMSJgoGYmxvY2tzGAMgAygLMg4uR3JpZEJsb2NrTWV0YVIGYmxvY2tz');
|
||||
@$core.Deprecated('Use gridBlockMetaDescriptor instead')
|
||||
const GridBlockMeta$json = const {
|
||||
'1': 'GridBlockMeta',
|
||||
'2': const [
|
||||
const {'1': 'block_id', '3': 1, '4': 1, '5': 9, '10': 'blockId'},
|
||||
const {'1': 'start_row_index', '3': 2, '4': 1, '5': 5, '10': 'startRowIndex'},
|
||||
const {'1': 'row_count', '3': 3, '4': 1, '5': 5, '10': 'rowCount'},
|
||||
],
|
||||
};
|
||||
|
||||
/// Descriptor for `GridBlockMeta`. Decode as a `google.protobuf.DescriptorProto`.
|
||||
final $typed_data.Uint8List gridBlockMetaDescriptor = $convert.base64Decode('Cg1HcmlkQmxvY2tNZXRhEhkKCGJsb2NrX2lkGAEgASgJUgdibG9ja0lkEiYKD3N0YXJ0X3Jvd19pbmRleBgCIAEoBVINc3RhcnRSb3dJbmRleBIbCglyb3dfY291bnQYAyABKAVSCHJvd0NvdW50');
|
||||
@$core.Deprecated('Use gridBlockMetaDataDescriptor instead')
|
||||
const GridBlockMetaData$json = const {
|
||||
'1': 'GridBlockMetaData',
|
||||
'2': const [
|
||||
const {'1': 'block_id', '3': 1, '4': 1, '5': 9, '10': 'blockId'},
|
||||
const {'1': 'rows', '3': 2, '4': 3, '5': 11, '6': '.RowMeta', '10': 'rows'},
|
||||
],
|
||||
};
|
||||
|
||||
/// Descriptor for `GridBlockMetaData`. Decode as a `google.protobuf.DescriptorProto`.
|
||||
final $typed_data.Uint8List gridBlockMetaDataDescriptor = $convert.base64Decode('ChFHcmlkQmxvY2tNZXRhRGF0YRIZCghibG9ja19pZBgBIAEoCVIHYmxvY2tJZBIcCgRyb3dzGAIgAygLMgguUm93TWV0YVIEcm93cw==');
|
||||
@$core.Deprecated('Use fieldMetaDescriptor instead')
|
||||
const FieldMeta$json = const {
|
||||
'1': 'FieldMeta',
|
||||
'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': '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': 'visibility', '3': 6, '4': 1, '5': 8, '10': 'visibility'},
|
||||
const {'1': 'width', '3': 7, '4': 1, '5': 5, '10': 'width'},
|
||||
const {'1': 'type_options', '3': 8, '4': 3, '5': 11, '6': '.FieldMeta.TypeOptionsEntry', '10': 'typeOptions'},
|
||||
],
|
||||
'3': const [FieldMeta_TypeOptionsEntry$json],
|
||||
};
|
||||
|
||||
@$core.Deprecated('Use fieldMetaDescriptor instead')
|
||||
const FieldMeta_TypeOptionsEntry$json = const {
|
||||
'1': 'TypeOptionsEntry',
|
||||
'2': const [
|
||||
const {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'},
|
||||
const {'1': 'value', '3': 2, '4': 1, '5': 9, '10': 'value'},
|
||||
],
|
||||
'7': const {'7': true},
|
||||
};
|
||||
|
||||
/// Descriptor for `FieldMeta`. Decode as a `google.protobuf.DescriptorProto`.
|
||||
final $typed_data.Uint8List fieldMetaDescriptor = $convert.base64Decode('CglGaWVsZE1ldGESDgoCaWQYASABKAlSAmlkEhIKBG5hbWUYAiABKAlSBG5hbWUSEgoEZGVzYxgDIAEoCVIEZGVzYxIpCgpmaWVsZF90eXBlGAQgASgOMgouRmllbGRUeXBlUglmaWVsZFR5cGUSFgoGZnJvemVuGAUgASgIUgZmcm96ZW4SHgoKdmlzaWJpbGl0eRgGIAEoCFIKdmlzaWJpbGl0eRIUCgV3aWR0aBgHIAEoBVIFd2lkdGgSPgoMdHlwZV9vcHRpb25zGAggAygLMhsuRmllbGRNZXRhLlR5cGVPcHRpb25zRW50cnlSC3R5cGVPcHRpb25zGj4KEFR5cGVPcHRpb25zRW50cnkSEAoDa2V5GAEgASgJUgNrZXkSFAoFdmFsdWUYAiABKAlSBXZhbHVlOgI4AQ==');
|
||||
@$core.Deprecated('Use fieldChangesetPayloadDescriptor instead')
|
||||
const FieldChangesetPayload$json = const {
|
||||
'1': 'FieldChangesetPayload',
|
||||
'2': const [
|
||||
const {'1': 'field_id', '3': 1, '4': 1, '5': 9, '10': 'fieldId'},
|
||||
const {'1': 'grid_id', '3': 2, '4': 1, '5': 9, '10': 'gridId'},
|
||||
const {'1': 'name', '3': 3, '4': 1, '5': 9, '9': 0, '10': 'name'},
|
||||
const {'1': 'desc', '3': 4, '4': 1, '5': 9, '9': 1, '10': 'desc'},
|
||||
const {'1': 'field_type', '3': 5, '4': 1, '5': 14, '6': '.FieldType', '9': 2, '10': 'fieldType'},
|
||||
const {'1': 'frozen', '3': 6, '4': 1, '5': 8, '9': 3, '10': 'frozen'},
|
||||
const {'1': 'visibility', '3': 7, '4': 1, '5': 8, '9': 4, '10': 'visibility'},
|
||||
const {'1': 'width', '3': 8, '4': 1, '5': 5, '9': 5, '10': 'width'},
|
||||
const {'1': 'type_option_data', '3': 9, '4': 1, '5': 12, '9': 6, '10': 'typeOptionData'},
|
||||
],
|
||||
'8': const [
|
||||
const {'1': 'one_of_name'},
|
||||
const {'1': 'one_of_desc'},
|
||||
const {'1': 'one_of_field_type'},
|
||||
const {'1': 'one_of_frozen'},
|
||||
const {'1': 'one_of_visibility'},
|
||||
const {'1': 'one_of_width'},
|
||||
const {'1': 'one_of_type_option_data'},
|
||||
],
|
||||
};
|
||||
|
||||
/// Descriptor for `FieldChangesetPayload`. Decode as a `google.protobuf.DescriptorProto`.
|
||||
final $typed_data.Uint8List fieldChangesetPayloadDescriptor = $convert.base64Decode('ChVGaWVsZENoYW5nZXNldFBheWxvYWQSGQoIZmllbGRfaWQYASABKAlSB2ZpZWxkSWQSFwoHZ3JpZF9pZBgCIAEoCVIGZ3JpZElkEhQKBG5hbWUYAyABKAlIAFIEbmFtZRIUCgRkZXNjGAQgASgJSAFSBGRlc2MSKwoKZmllbGRfdHlwZRgFIAEoDjIKLkZpZWxkVHlwZUgCUglmaWVsZFR5cGUSGAoGZnJvemVuGAYgASgISANSBmZyb3plbhIgCgp2aXNpYmlsaXR5GAcgASgISARSCnZpc2liaWxpdHkSFgoFd2lkdGgYCCABKAVIBVIFd2lkdGgSKgoQdHlwZV9vcHRpb25fZGF0YRgJIAEoDEgGUg50eXBlT3B0aW9uRGF0YUINCgtvbmVfb2ZfbmFtZUINCgtvbmVfb2ZfZGVzY0ITChFvbmVfb2ZfZmllbGRfdHlwZUIPCg1vbmVfb2ZfZnJvemVuQhMKEW9uZV9vZl92aXNpYmlsaXR5Qg4KDG9uZV9vZl93aWR0aEIZChdvbmVfb2ZfdHlwZV9vcHRpb25fZGF0YQ==');
|
||||
@$core.Deprecated('Use anyDataDescriptor instead')
|
||||
const AnyData$json = const {
|
||||
'1': 'AnyData',
|
||||
'2': const [
|
||||
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('CgdBbnlEYXRhEhcKB3R5cGVfaWQYASABKAlSBnR5cGVJZBIUCgV2YWx1ZRgCIAEoDFIFdmFsdWU=');
|
||||
@$core.Deprecated('Use rowMetaDescriptor instead')
|
||||
const RowMeta$json = const {
|
||||
'1': 'RowMeta',
|
||||
'2': const [
|
||||
const {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'},
|
||||
const {'1': 'block_id', '3': 2, '4': 1, '5': 9, '10': 'blockId'},
|
||||
const {'1': 'cells', '3': 3, '4': 3, '5': 11, '6': '.RowMeta.CellsEntry', '10': 'cells'},
|
||||
const {'1': 'height', '3': 4, '4': 1, '5': 5, '10': 'height'},
|
||||
const {'1': 'visibility', '3': 5, '4': 1, '5': 8, '10': 'visibility'},
|
||||
],
|
||||
'3': const [RowMeta_CellsEntry$json],
|
||||
};
|
||||
|
||||
@$core.Deprecated('Use rowMetaDescriptor instead')
|
||||
const RowMeta_CellsEntry$json = const {
|
||||
'1': 'CellsEntry',
|
||||
'2': const [
|
||||
const {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'},
|
||||
const {'1': 'value', '3': 2, '4': 1, '5': 11, '6': '.CellMeta', '10': 'value'},
|
||||
],
|
||||
'7': const {'7': true},
|
||||
};
|
||||
|
||||
/// Descriptor for `RowMeta`. Decode as a `google.protobuf.DescriptorProto`.
|
||||
final $typed_data.Uint8List rowMetaDescriptor = $convert.base64Decode('CgdSb3dNZXRhEg4KAmlkGAEgASgJUgJpZBIZCghibG9ja19pZBgCIAEoCVIHYmxvY2tJZBIpCgVjZWxscxgDIAMoCzITLlJvd01ldGEuQ2VsbHNFbnRyeVIFY2VsbHMSFgoGaGVpZ2h0GAQgASgFUgZoZWlnaHQSHgoKdmlzaWJpbGl0eRgFIAEoCFIKdmlzaWJpbGl0eRpDCgpDZWxsc0VudHJ5EhAKA2tleRgBIAEoCVIDa2V5Eh8KBXZhbHVlGAIgASgLMgkuQ2VsbE1ldGFSBXZhbHVlOgI4AQ==');
|
||||
@$core.Deprecated('Use rowMetaChangesetDescriptor instead')
|
||||
const RowMetaChangeset$json = const {
|
||||
'1': 'RowMetaChangeset',
|
||||
'2': const [
|
||||
const {'1': 'row_id', '3': 1, '4': 1, '5': 9, '10': 'rowId'},
|
||||
const {'1': 'height', '3': 2, '4': 1, '5': 5, '9': 0, '10': 'height'},
|
||||
const {'1': 'visibility', '3': 3, '4': 1, '5': 8, '9': 1, '10': 'visibility'},
|
||||
const {'1': 'cell_by_field_id', '3': 4, '4': 3, '5': 11, '6': '.RowMetaChangeset.CellByFieldIdEntry', '10': 'cellByFieldId'},
|
||||
],
|
||||
'3': const [RowMetaChangeset_CellByFieldIdEntry$json],
|
||||
'8': const [
|
||||
const {'1': 'one_of_height'},
|
||||
const {'1': 'one_of_visibility'},
|
||||
],
|
||||
};
|
||||
|
||||
@$core.Deprecated('Use rowMetaChangesetDescriptor instead')
|
||||
const RowMetaChangeset_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': '.CellMeta', '10': 'value'},
|
||||
],
|
||||
'7': const {'7': true},
|
||||
};
|
||||
|
||||
/// Descriptor for `RowMetaChangeset`. Decode as a `google.protobuf.DescriptorProto`.
|
||||
final $typed_data.Uint8List rowMetaChangesetDescriptor = $convert.base64Decode('ChBSb3dNZXRhQ2hhbmdlc2V0EhUKBnJvd19pZBgBIAEoCVIFcm93SWQSGAoGaGVpZ2h0GAIgASgFSABSBmhlaWdodBIgCgp2aXNpYmlsaXR5GAMgASgISAFSCnZpc2liaWxpdHkSTQoQY2VsbF9ieV9maWVsZF9pZBgEIAMoCzIkLlJvd01ldGFDaGFuZ2VzZXQuQ2VsbEJ5RmllbGRJZEVudHJ5Ug1jZWxsQnlGaWVsZElkGksKEkNlbGxCeUZpZWxkSWRFbnRyeRIQCgNrZXkYASABKAlSA2tleRIfCgV2YWx1ZRgCIAEoCzIJLkNlbGxNZXRhUgV2YWx1ZToCOAFCDwoNb25lX29mX2hlaWdodEITChFvbmVfb2ZfdmlzaWJpbGl0eQ==');
|
||||
@$core.Deprecated('Use cellMetaDescriptor instead')
|
||||
const CellMeta$json = const {
|
||||
'1': 'CellMeta',
|
||||
'2': const [
|
||||
const {'1': 'data', '3': 1, '4': 1, '5': 9, '10': 'data'},
|
||||
],
|
||||
};
|
||||
|
||||
/// Descriptor for `CellMeta`. Decode as a `google.protobuf.DescriptorProto`.
|
||||
final $typed_data.Uint8List cellMetaDescriptor = $convert.base64Decode('CghDZWxsTWV0YRISCgRkYXRhGAEgASgJUgRkYXRh');
|
||||
@$core.Deprecated('Use cellMetaChangesetDescriptor instead')
|
||||
const CellMetaChangeset$json = const {
|
||||
'1': 'CellMetaChangeset',
|
||||
'2': const [
|
||||
const {'1': 'grid_id', '3': 1, '4': 1, '5': 9, '10': 'gridId'},
|
||||
const {'1': 'row_id', '3': 2, '4': 1, '5': 9, '10': 'rowId'},
|
||||
const {'1': 'field_id', '3': 3, '4': 1, '5': 9, '10': 'fieldId'},
|
||||
const {'1': 'data', '3': 4, '4': 1, '5': 9, '9': 0, '10': 'data'},
|
||||
],
|
||||
'8': const [
|
||||
const {'1': 'one_of_data'},
|
||||
],
|
||||
};
|
||||
|
||||
/// Descriptor for `CellMetaChangeset`. Decode as a `google.protobuf.DescriptorProto`.
|
||||
final $typed_data.Uint8List cellMetaChangesetDescriptor = $convert.base64Decode('ChFDZWxsTWV0YUNoYW5nZXNldBIXCgdncmlkX2lkGAEgASgJUgZncmlkSWQSFQoGcm93X2lkGAIgASgJUgVyb3dJZBIZCghmaWVsZF9pZBgDIAEoCVIHZmllbGRJZBIUCgRkYXRhGAQgASgJSABSBGRhdGFCDQoLb25lX29mX2RhdGE=');
|
||||
@$core.Deprecated('Use buildGridContextDescriptor instead')
|
||||
const BuildGridContext$json = const {
|
||||
'1': 'BuildGridContext',
|
||||
'2': const [
|
||||
const {'1': 'field_metas', '3': 1, '4': 3, '5': 11, '6': '.FieldMeta', '10': 'fieldMetas'},
|
||||
const {'1': 'block_meta', '3': 2, '4': 1, '5': 11, '6': '.GridBlockMeta', '10': 'blockMeta'},
|
||||
const {'1': 'block_meta_data', '3': 3, '4': 1, '5': 11, '6': '.GridBlockMetaData', '10': 'blockMetaData'},
|
||||
],
|
||||
};
|
||||
|
||||
/// Descriptor for `BuildGridContext`. Decode as a `google.protobuf.DescriptorProto`.
|
||||
final $typed_data.Uint8List buildGridContextDescriptor = $convert.base64Decode('ChBCdWlsZEdyaWRDb250ZXh0EisKC2ZpZWxkX21ldGFzGAEgAygLMgouRmllbGRNZXRhUgpmaWVsZE1ldGFzEi0KCmJsb2NrX21ldGEYAiABKAsyDi5HcmlkQmxvY2tNZXRhUglibG9ja01ldGESOgoPYmxvY2tfbWV0YV9kYXRhGAMgASgLMhIuR3JpZEJsb2NrTWV0YURhdGFSDWJsb2NrTWV0YURhdGE=');
|
@ -1,9 +0,0 @@
|
||||
///
|
||||
// Generated code. Do not modify.
|
||||
// source: meta.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 'meta.pb.dart';
|
||||
|
@ -1,3 +1,2 @@
|
||||
// Auto-generated, do not edit
|
||||
export './grid.pb.dart';
|
||||
export './meta.pb.dart';
|
||||
|
7
frontend/rust-lib/Cargo.lock
generated
7
frontend/rust-lib/Cargo.lock
generated
@ -946,6 +946,7 @@ dependencies = [
|
||||
"flowy-revision",
|
||||
"flowy-sync",
|
||||
"flowy-test",
|
||||
"indexmap",
|
||||
"lazy_static",
|
||||
"lib-dispatch",
|
||||
"lib-infra",
|
||||
@ -971,6 +972,7 @@ dependencies = [
|
||||
"bytes",
|
||||
"flowy-derive",
|
||||
"flowy-error-code",
|
||||
"indexmap",
|
||||
"lib-infra",
|
||||
"protobuf",
|
||||
"serde",
|
||||
@ -1611,12 +1613,13 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683"
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.8.0"
|
||||
version = "1.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223"
|
||||
checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"hashbrown",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -34,6 +34,7 @@ rayon = "1.5"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = {version = "1.0"}
|
||||
serde_repr = "0.1"
|
||||
indexmap = {version = "1.8.1", features = ["serde"]}
|
||||
|
||||
[dev-dependencies]
|
||||
flowy-test = { path = "../flowy-test" }
|
||||
|
@ -227,10 +227,10 @@ pub(crate) async fn get_cell_handler(
|
||||
|
||||
#[tracing::instrument(level = "debug", skip_all, err)]
|
||||
pub(crate) async fn update_cell_handler(
|
||||
data: Data<CellMetaChangeset>,
|
||||
data: Data<CellChangeset>,
|
||||
manager: AppData<Arc<GridManager>>,
|
||||
) -> Result<(), FlowyError> {
|
||||
let changeset: CellMetaChangeset = data.into_inner();
|
||||
let changeset: CellChangeset = data.into_inner();
|
||||
let editor = manager.get_grid_editor(&changeset.grid_id)?;
|
||||
let _ = editor.update_cell(changeset).await?;
|
||||
Ok(())
|
||||
@ -271,7 +271,7 @@ pub(crate) async fn select_option_changeset_handler(
|
||||
field_meta.insert_type_option_entry(&*type_option);
|
||||
let _ = editor.replace_field(field_meta).await?;
|
||||
|
||||
let changeset = CellMetaChangeset {
|
||||
let changeset = CellChangeset {
|
||||
grid_id: changeset.cell_identifier.grid_id,
|
||||
row_id: changeset.cell_identifier.row_id,
|
||||
field_id: changeset.cell_identifier.field_id,
|
||||
@ -310,7 +310,7 @@ pub(crate) async fn select_option_cell_changeset_handler(
|
||||
) -> Result<(), FlowyError> {
|
||||
let params: SelectOptionCellChangesetParams = data.into_inner().try_into()?;
|
||||
let editor = manager.get_grid_editor(¶ms.grid_id)?;
|
||||
let changeset: CellMetaChangeset = params.into();
|
||||
let changeset: CellChangeset = params.into();
|
||||
let _ = editor.update_cell(changeset).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ pub enum GridEvent {
|
||||
#[event(input = "CellIdentifierPayload", output = "Cell")]
|
||||
GetCell = 70,
|
||||
|
||||
#[event(input = "CellMetaChangeset")]
|
||||
#[event(input = "CellChangeset")]
|
||||
UpdateCell = 71,
|
||||
|
||||
#[event(input = "SelectOptionCellChangesetPayload")]
|
||||
|
@ -8,7 +8,7 @@ use std::borrow::Cow;
|
||||
use dashmap::DashMap;
|
||||
use flowy_error::FlowyResult;
|
||||
use flowy_grid_data_model::entities::{
|
||||
CellMeta, CellMetaChangeset, CellNotificationData, FieldMeta, GridBlockMeta, GridBlockMetaChangeset,
|
||||
CellChangeset, CellMeta, CellNotificationData, FieldMeta, GridBlockMeta, GridBlockMetaChangeset,
|
||||
GridBlockOrderChangeset, IndexRowOrder, RowMeta, RowMetaChangeset, RowOrder,
|
||||
};
|
||||
use flowy_revision::disk::SQLiteGridBlockMetaRevisionPersistence;
|
||||
@ -154,7 +154,7 @@ impl GridBlockMetaEditorManager {
|
||||
Ok(changesets)
|
||||
}
|
||||
|
||||
pub async fn update_cell(&self, changeset: CellMetaChangeset) -> FlowyResult<()> {
|
||||
pub async fn update_cell(&self, changeset: CellChangeset) -> FlowyResult<()> {
|
||||
let row_id = changeset.row_id.clone();
|
||||
let editor = self.get_editor_from_row_id(&row_id).await?;
|
||||
let row_changeset: RowMetaChangeset = changeset.clone().into();
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::services::field::type_options::*;
|
||||
use bytes::Bytes;
|
||||
use flowy_grid_data_model::entities::{Field, FieldMeta, FieldType, TypeOptionDataEntry};
|
||||
use std::collections::HashMap;
|
||||
use indexmap::IndexMap;
|
||||
|
||||
pub struct FieldBuilder {
|
||||
field_meta: FieldMeta,
|
||||
@ -34,7 +34,7 @@ impl FieldBuilder {
|
||||
frozen: field.frozen,
|
||||
visibility: field.visibility,
|
||||
width: field.width,
|
||||
type_options: HashMap::default(),
|
||||
type_options: IndexMap::default(),
|
||||
};
|
||||
Self {
|
||||
field_meta,
|
||||
|
@ -7,7 +7,7 @@ use bytes::Bytes;
|
||||
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
|
||||
use flowy_error::{ErrorCode, FlowyError};
|
||||
use flowy_grid_data_model::entities::{
|
||||
CellMeta, CellMetaChangeset, FieldMeta, FieldType, TypeOptionDataDeserializer, TypeOptionDataEntry,
|
||||
CellChangeset, CellMeta, FieldMeta, FieldType, TypeOptionDataDeserializer, TypeOptionDataEntry,
|
||||
};
|
||||
use flowy_grid_data_model::parser::NotEmptyUuid;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -356,14 +356,14 @@ impl SelectOptionCellChangeset {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::convert::From<SelectOptionCellChangesetParams> for CellMetaChangeset {
|
||||
impl std::convert::From<SelectOptionCellChangesetParams> for CellChangeset {
|
||||
fn from(params: SelectOptionCellChangesetParams) -> Self {
|
||||
let changeset = SelectOptionCellChangeset {
|
||||
insert_option_id: params.insert_option_id,
|
||||
delete_option_id: params.delete_option_id,
|
||||
};
|
||||
let s = serde_json::to_string(&changeset).unwrap();
|
||||
CellMetaChangeset {
|
||||
CellChangeset {
|
||||
grid_id: params.grid_id,
|
||||
row_id: params.row_id,
|
||||
field_id: params.field_id,
|
||||
|
@ -40,7 +40,7 @@ impl CellDataOperation for RichTextTypeOption {
|
||||
|| type_option_cell_data.is_multi_select()
|
||||
|| type_option_cell_data.is_number()
|
||||
{
|
||||
decode_cell_data(data, &field_meta, &type_option_cell_data.field_type).unwrap_or_else(|| "".to_owned())
|
||||
decode_cell_data(data, field_meta, &type_option_cell_data.field_type).unwrap_or_else(|| "".to_owned())
|
||||
} else {
|
||||
type_option_cell_data.data
|
||||
}
|
||||
|
@ -293,13 +293,15 @@ impl ClientGridEditor {
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn update_cell(&self, mut changeset: CellMetaChangeset) -> FlowyResult<()> {
|
||||
#[tracing::instrument(level = "trace", skip_all, err)]
|
||||
pub async fn update_cell(&self, mut changeset: CellChangeset) -> FlowyResult<()> {
|
||||
if changeset.data.as_ref().is_none() {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let cell_data_changeset = changeset.data.unwrap();
|
||||
let cell_meta = self.get_cell_meta(&changeset.row_id, &changeset.field_id).await?;
|
||||
tracing::trace!("{}: {:?}", &changeset.field_id, cell_meta);
|
||||
match self.pad.read().await.get_field(&changeset.field_id) {
|
||||
None => {
|
||||
let msg = format!("Field not found with id: {}", &changeset.field_id);
|
||||
@ -431,7 +433,7 @@ impl ClientGridEditor {
|
||||
|
||||
if let Some(field_meta) = field_metas.pop() {
|
||||
send_dart_notification(field_id, GridNotification::DidUpdateField)
|
||||
.payload(field_meta)
|
||||
.payload(Field::from(field_meta))
|
||||
.send();
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ use crate::services::row::apply_cell_data_changeset;
|
||||
use crate::services::field::SelectOptionCellChangeset;
|
||||
use flowy_error::{FlowyError, FlowyResult};
|
||||
use flowy_grid_data_model::entities::{CellMeta, FieldMeta, RowMeta, DEFAULT_ROW_HEIGHT};
|
||||
use indexmap::IndexMap;
|
||||
use std::collections::HashMap;
|
||||
|
||||
pub struct CreateRowMetaBuilder<'a> {
|
||||
@ -90,7 +91,7 @@ pub fn make_row_meta_from_context(block_id: &str, payload: CreateRowMetaPayload)
|
||||
|
||||
pub struct CreateRowMetaPayload {
|
||||
pub row_id: String,
|
||||
pub cell_by_field_id: HashMap<String, CellMeta>,
|
||||
pub cell_by_field_id: IndexMap<String, CellMeta>,
|
||||
pub height: i32,
|
||||
pub visibility: bool,
|
||||
}
|
||||
|
@ -3,10 +3,7 @@ use flowy_error::FlowyResult;
|
||||
use flowy_grid_data_model::entities::{
|
||||
Cell, CellMeta, FieldMeta, GridBlock, GridBlockOrder, RepeatedGridBlock, Row, RowMeta, RowOrder,
|
||||
};
|
||||
use rayon::iter::{IntoParallelIterator, ParallelIterator};
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
pub struct GridBlockSnapshot {
|
||||
@ -60,7 +57,7 @@ pub(crate) fn make_rows_from_row_metas(fields: &[FieldMeta], row_metas: &[Arc<Ro
|
||||
let cell_by_field_id = row_meta
|
||||
.cells
|
||||
.clone()
|
||||
.into_par_iter()
|
||||
.into_iter()
|
||||
.flat_map(|(field_id, cell_meta)| make_cell_by_field_id(&field_meta_map, field_id, cell_meta))
|
||||
.collect::<HashMap<String, Cell>>();
|
||||
|
||||
|
@ -6,7 +6,7 @@ use flowy_grid::services::field::{
|
||||
};
|
||||
use flowy_grid::services::row::{decode_cell_data, CreateRowMetaBuilder};
|
||||
use flowy_grid_data_model::entities::{
|
||||
CellMetaChangeset, FieldChangesetParams, FieldType, GridBlockMeta, GridBlockMetaChangeset, RowMetaChangeset,
|
||||
CellChangeset, FieldChangesetParams, FieldType, GridBlockMeta, GridBlockMetaChangeset, RowMetaChangeset,
|
||||
TypeOptionDataEntry,
|
||||
};
|
||||
|
||||
@ -324,7 +324,7 @@ async fn grid_cell_update() {
|
||||
};
|
||||
|
||||
scripts.push(UpdateCell {
|
||||
changeset: CellMetaChangeset {
|
||||
changeset: CellChangeset {
|
||||
grid_id: block_id.to_string(),
|
||||
row_id: row_meta.id.clone(),
|
||||
field_id: field_meta.id.clone(),
|
||||
@ -345,7 +345,7 @@ async fn grid_cell_update() {
|
||||
};
|
||||
|
||||
scripts.push(UpdateCell {
|
||||
changeset: CellMetaChangeset {
|
||||
changeset: CellChangeset {
|
||||
grid_id: block_id.to_string(),
|
||||
row_id: row_meta.id.clone(),
|
||||
field_id: field_meta.id.clone(),
|
||||
|
@ -3,8 +3,8 @@ use flowy_grid::services::field::*;
|
||||
use flowy_grid::services::grid_editor::{ClientGridEditor, GridPadBuilder};
|
||||
use flowy_grid::services::row::CreateRowMetaPayload;
|
||||
use flowy_grid_data_model::entities::{
|
||||
BuildGridContext, CellMetaChangeset, CreateFieldParams, Field, FieldChangesetParams, FieldMeta, FieldOrder,
|
||||
FieldType, GridBlockMeta, GridBlockMetaChangeset, RowMeta, RowMetaChangeset, RowOrder, TypeOptionDataEntry,
|
||||
BuildGridContext, CellChangeset, CreateFieldParams, Field, FieldChangesetParams, FieldMeta, FieldOrder, FieldType,
|
||||
GridBlockMeta, GridBlockMetaChangeset, RowMeta, RowMetaChangeset, RowOrder, TypeOptionDataEntry,
|
||||
};
|
||||
use flowy_revision::REVISION_WRITE_INTERVAL_IN_MILLIS;
|
||||
use flowy_sync::client_grid::GridBuilder;
|
||||
@ -61,7 +61,7 @@ pub enum EditorScript {
|
||||
row_ids: Vec<String>,
|
||||
},
|
||||
UpdateCell {
|
||||
changeset: CellMetaChangeset,
|
||||
changeset: CellChangeset,
|
||||
is_err: bool,
|
||||
},
|
||||
AssertRowCount(usize),
|
||||
@ -86,7 +86,7 @@ impl GridEditorTest {
|
||||
let sdk = FlowySDKTest::default();
|
||||
let _ = sdk.init_user().await;
|
||||
let build_context = make_template_1_grid();
|
||||
let view_data: Bytes = build_context.try_into().unwrap();
|
||||
let view_data: Bytes = build_context.into();
|
||||
let test = ViewTest::new_grid_view(&sdk, view_data.to_vec()).await;
|
||||
let editor = sdk.grid_manager.open_grid(&test.view.id).await.unwrap();
|
||||
let field_metas = editor.get_field_metas::<FieldOrder>(None).await.unwrap();
|
||||
|
@ -14,7 +14,7 @@ use flowy_folder::{
|
||||
};
|
||||
use flowy_grid::manager::{make_grid_view_data, GridManager};
|
||||
use flowy_grid::util::make_default_grid;
|
||||
use flowy_grid_data_model::entities::BuildGridContext;
|
||||
|
||||
use flowy_net::ClientServerConfiguration;
|
||||
use flowy_net::{
|
||||
http_server::folder::FolderHttpCloudService, local_server::LocalServer, ws::connection::FlowyWebSocketConnect,
|
||||
@ -25,6 +25,8 @@ use futures_core::future::BoxFuture;
|
||||
use lib_infra::future::{BoxResultFuture, FutureResult};
|
||||
use lib_ws::{WSChannel, WSMessageReceiver, WebSocketRawMessage};
|
||||
use std::collections::HashMap;
|
||||
|
||||
use flowy_grid_data_model::entities::BuildGridContext;
|
||||
use std::convert::TryFrom;
|
||||
use std::{convert::TryInto, sync::Arc};
|
||||
|
||||
|
18
shared-lib/Cargo.lock
generated
18
shared-lib/Cargo.lock
generated
@ -458,6 +458,7 @@ dependencies = [
|
||||
"bytes",
|
||||
"flowy-derive",
|
||||
"flowy-error-code",
|
||||
"indexmap",
|
||||
"lib-infra",
|
||||
"protobuf",
|
||||
"serde",
|
||||
@ -701,6 +702,12 @@ dependencies = [
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.3.3"
|
||||
@ -777,6 +784,17 @@ dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"hashbrown",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "instant"
|
||||
version = "0.1.12"
|
||||
|
@ -16,7 +16,7 @@ serde_json = {version = "1.0"}
|
||||
serde_repr = "0.1"
|
||||
uuid = { version = "0.8", features = ["serde", "v4"] }
|
||||
flowy-error-code = { path = "../flowy-error-code"}
|
||||
|
||||
indexmap = {version = "1.8.1", features = ["serde"]}
|
||||
[build-dependencies]
|
||||
lib-infra = { path = "../lib-infra", features = ["protobuf_file_gen"] }
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
|
||||
proto_crates = ["src/entities",]
|
||||
proto_crates = ["src/entities/grid.rs",]
|
||||
event_files = []
|
@ -1,9 +1,12 @@
|
||||
use crate::entities::{FieldMeta, FieldType, RowMeta};
|
||||
use crate::entities::{CellMeta, FieldMeta, RowMeta, RowMetaChangeset};
|
||||
use crate::parser::NotEmptyUuid;
|
||||
use flowy_derive::ProtoBuf;
|
||||
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
|
||||
use flowy_error_code::ErrorCode;
|
||||
|
||||
use serde_repr::*;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
use strum_macros::{Display, EnumCount as EnumCountMacro, EnumIter, EnumString};
|
||||
|
||||
#[derive(Debug, Clone, Default, ProtoBuf)]
|
||||
pub struct Grid {
|
||||
@ -574,3 +577,169 @@ impl TryInto<QueryGridBlocksParams> for QueryGridBlocksPayload {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, ProtoBuf)]
|
||||
pub struct FieldChangesetPayload {
|
||||
#[pb(index = 1)]
|
||||
pub field_id: String,
|
||||
|
||||
#[pb(index = 2)]
|
||||
pub grid_id: String,
|
||||
|
||||
#[pb(index = 3, one_of)]
|
||||
pub name: Option<String>,
|
||||
|
||||
#[pb(index = 4, one_of)]
|
||||
pub desc: Option<String>,
|
||||
|
||||
#[pb(index = 5, one_of)]
|
||||
pub field_type: Option<FieldType>,
|
||||
|
||||
#[pb(index = 6, one_of)]
|
||||
pub frozen: Option<bool>,
|
||||
|
||||
#[pb(index = 7, one_of)]
|
||||
pub visibility: Option<bool>,
|
||||
|
||||
#[pb(index = 8, one_of)]
|
||||
pub width: Option<i32>,
|
||||
|
||||
#[pb(index = 9, one_of)]
|
||||
pub type_option_data: Option<Vec<u8>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct FieldChangesetParams {
|
||||
pub field_id: String,
|
||||
|
||||
pub grid_id: String,
|
||||
|
||||
pub name: Option<String>,
|
||||
|
||||
pub desc: Option<String>,
|
||||
|
||||
pub field_type: Option<FieldType>,
|
||||
|
||||
pub frozen: Option<bool>,
|
||||
|
||||
pub visibility: Option<bool>,
|
||||
|
||||
pub width: Option<i32>,
|
||||
|
||||
pub type_option_data: Option<Vec<u8>>,
|
||||
}
|
||||
|
||||
impl TryInto<FieldChangesetParams> for FieldChangesetPayload {
|
||||
type Error = ErrorCode;
|
||||
|
||||
fn try_into(self) -> Result<FieldChangesetParams, Self::Error> {
|
||||
let grid_id = NotEmptyUuid::parse(self.grid_id).map_err(|_| ErrorCode::GridIdIsEmpty)?;
|
||||
let field_id = NotEmptyUuid::parse(self.field_id).map_err(|_| ErrorCode::FieldIdIsEmpty)?;
|
||||
|
||||
if let Some(type_option_data) = self.type_option_data.as_ref() {
|
||||
if type_option_data.is_empty() {
|
||||
return Err(ErrorCode::TypeOptionDataIsEmpty);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(FieldChangesetParams {
|
||||
field_id: field_id.0,
|
||||
grid_id: grid_id.0,
|
||||
name: self.name,
|
||||
desc: self.desc,
|
||||
field_type: self.field_type,
|
||||
frozen: self.frozen,
|
||||
visibility: self.visibility,
|
||||
width: self.width,
|
||||
type_option_data: self.type_option_data,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Debug,
|
||||
Clone,
|
||||
PartialEq,
|
||||
Eq,
|
||||
ProtoBuf_Enum,
|
||||
EnumCountMacro,
|
||||
EnumString,
|
||||
EnumIter,
|
||||
Display,
|
||||
Serialize_repr,
|
||||
Deserialize_repr,
|
||||
)]
|
||||
#[repr(u8)]
|
||||
pub enum FieldType {
|
||||
RichText = 0,
|
||||
Number = 1,
|
||||
DateTime = 2,
|
||||
SingleSelect = 3,
|
||||
MultiSelect = 4,
|
||||
Checkbox = 5,
|
||||
}
|
||||
|
||||
impl std::default::Default for FieldType {
|
||||
fn default() -> Self {
|
||||
FieldType::RichText
|
||||
}
|
||||
}
|
||||
|
||||
impl AsRef<FieldType> for FieldType {
|
||||
fn as_ref(&self) -> &FieldType {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&FieldType> for FieldType {
|
||||
fn from(field_type: &FieldType) -> Self {
|
||||
field_type.clone()
|
||||
}
|
||||
}
|
||||
|
||||
impl FieldType {
|
||||
pub fn type_id(&self) -> String {
|
||||
let ty = self.clone();
|
||||
format!("{}", ty as u8)
|
||||
}
|
||||
|
||||
pub fn default_cell_width(&self) -> i32 {
|
||||
match self {
|
||||
FieldType::DateTime => 180,
|
||||
_ => 150,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, ProtoBuf)]
|
||||
pub struct CellChangeset {
|
||||
#[pb(index = 1)]
|
||||
pub grid_id: String,
|
||||
|
||||
#[pb(index = 2)]
|
||||
pub row_id: String,
|
||||
|
||||
#[pb(index = 3)]
|
||||
pub field_id: String,
|
||||
|
||||
#[pb(index = 4, one_of)]
|
||||
pub data: Option<String>,
|
||||
}
|
||||
|
||||
impl std::convert::From<CellChangeset> for RowMetaChangeset {
|
||||
fn from(changeset: CellChangeset) -> Self {
|
||||
let mut cell_by_field_id = HashMap::with_capacity(1);
|
||||
let field_id = changeset.field_id;
|
||||
let cell_meta = CellMeta {
|
||||
data: changeset.data.unwrap_or_else(|| "".to_owned()),
|
||||
};
|
||||
cell_by_field_id.insert(field_id, cell_meta);
|
||||
|
||||
RowMetaChangeset {
|
||||
row_id: changeset.row_id,
|
||||
height: None,
|
||||
visibility: None,
|
||||
cell_by_field_id,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,35 +1,24 @@
|
||||
use crate::parser::NotEmptyUuid;
|
||||
use crate::entities::FieldType;
|
||||
|
||||
use bytes::Bytes;
|
||||
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
|
||||
use flowy_error_code::ErrorCode;
|
||||
|
||||
use indexmap::IndexMap;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_repr::*;
|
||||
use std::collections::HashMap;
|
||||
use strum_macros::{Display, EnumCount as EnumCountMacro, EnumIter, EnumString};
|
||||
|
||||
pub const DEFAULT_ROW_HEIGHT: i32 = 42;
|
||||
|
||||
#[derive(Debug, Clone, Default, Serialize, Deserialize, ProtoBuf)]
|
||||
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
|
||||
pub struct GridMeta {
|
||||
#[pb(index = 1)]
|
||||
pub grid_id: String,
|
||||
|
||||
#[pb(index = 2)]
|
||||
pub fields: Vec<FieldMeta>,
|
||||
|
||||
#[pb(index = 3)]
|
||||
pub blocks: Vec<GridBlockMeta>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize, ProtoBuf)]
|
||||
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct GridBlockMeta {
|
||||
#[pb(index = 1)]
|
||||
pub block_id: String,
|
||||
|
||||
#[pb(index = 2)]
|
||||
pub start_row_index: i32,
|
||||
|
||||
#[pb(index = 3)]
|
||||
pub row_count: i32,
|
||||
}
|
||||
|
||||
@ -68,43 +57,34 @@ impl GridBlockMetaChangeset {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, Serialize, Deserialize, ProtoBuf)]
|
||||
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
|
||||
pub struct GridBlockMetaData {
|
||||
#[pb(index = 1)]
|
||||
pub block_id: String,
|
||||
|
||||
#[pb(index = 2)]
|
||||
pub rows: Vec<RowMeta>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, Serialize, Deserialize, ProtoBuf, Eq, PartialEq)]
|
||||
#[derive(Debug, Clone, Default, Serialize, Deserialize, Eq, PartialEq)]
|
||||
pub struct FieldMeta {
|
||||
#[pb(index = 1)]
|
||||
pub id: String,
|
||||
|
||||
#[pb(index = 2)]
|
||||
pub name: String,
|
||||
|
||||
#[pb(index = 3)]
|
||||
pub desc: String,
|
||||
|
||||
#[pb(index = 4)]
|
||||
pub field_type: FieldType,
|
||||
|
||||
#[pb(index = 5)]
|
||||
pub frozen: bool,
|
||||
|
||||
#[pb(index = 6)]
|
||||
pub visibility: bool,
|
||||
|
||||
#[pb(index = 7)]
|
||||
pub width: i32,
|
||||
|
||||
#[pb(index = 8)]
|
||||
// #[pb(index = 8)]
|
||||
/// type_options contains key/value pairs
|
||||
/// key: id of the FieldType
|
||||
/// value: type option data string
|
||||
pub type_options: HashMap<String, String>,
|
||||
#[serde(with = "indexmap::serde_seq")]
|
||||
pub type_options: IndexMap<String, String>,
|
||||
}
|
||||
|
||||
impl FieldMeta {
|
||||
@ -156,180 +136,16 @@ pub trait TypeOptionDataDeserializer {
|
||||
fn from_protobuf_bytes(bytes: Bytes) -> Self;
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, ProtoBuf)]
|
||||
pub struct FieldChangesetPayload {
|
||||
#[pb(index = 1)]
|
||||
pub field_id: String,
|
||||
|
||||
#[pb(index = 2)]
|
||||
pub grid_id: String,
|
||||
|
||||
#[pb(index = 3, one_of)]
|
||||
pub name: Option<String>,
|
||||
|
||||
#[pb(index = 4, one_of)]
|
||||
pub desc: Option<String>,
|
||||
|
||||
#[pb(index = 5, one_of)]
|
||||
pub field_type: Option<FieldType>,
|
||||
|
||||
#[pb(index = 6, one_of)]
|
||||
pub frozen: Option<bool>,
|
||||
|
||||
#[pb(index = 7, one_of)]
|
||||
pub visibility: Option<bool>,
|
||||
|
||||
#[pb(index = 8, one_of)]
|
||||
pub width: Option<i32>,
|
||||
|
||||
#[pb(index = 9, one_of)]
|
||||
pub type_option_data: Option<Vec<u8>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct FieldChangesetParams {
|
||||
pub field_id: String,
|
||||
pub grid_id: String,
|
||||
pub name: Option<String>,
|
||||
pub desc: Option<String>,
|
||||
pub field_type: Option<FieldType>,
|
||||
pub frozen: Option<bool>,
|
||||
pub visibility: Option<bool>,
|
||||
pub width: Option<i32>,
|
||||
pub type_option_data: Option<Vec<u8>>,
|
||||
}
|
||||
|
||||
impl TryInto<FieldChangesetParams> for FieldChangesetPayload {
|
||||
type Error = ErrorCode;
|
||||
|
||||
fn try_into(self) -> Result<FieldChangesetParams, Self::Error> {
|
||||
let grid_id = NotEmptyUuid::parse(self.grid_id).map_err(|_| ErrorCode::GridIdIsEmpty)?;
|
||||
let field_id = NotEmptyUuid::parse(self.field_id).map_err(|_| ErrorCode::FieldIdIsEmpty)?;
|
||||
|
||||
if let Some(type_option_data) = self.type_option_data.as_ref() {
|
||||
if type_option_data.is_empty() {
|
||||
return Err(ErrorCode::TypeOptionDataIsEmpty);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(FieldChangesetParams {
|
||||
field_id: field_id.0,
|
||||
grid_id: grid_id.0,
|
||||
name: self.name,
|
||||
desc: self.desc,
|
||||
field_type: self.field_type,
|
||||
frozen: self.frozen,
|
||||
visibility: self.visibility,
|
||||
width: self.width,
|
||||
type_option_data: self.type_option_data,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Debug,
|
||||
Clone,
|
||||
PartialEq,
|
||||
Eq,
|
||||
ProtoBuf_Enum,
|
||||
EnumCountMacro,
|
||||
EnumString,
|
||||
EnumIter,
|
||||
Display,
|
||||
Serialize_repr,
|
||||
Deserialize_repr,
|
||||
)]
|
||||
#[repr(u8)]
|
||||
pub enum FieldType {
|
||||
RichText = 0,
|
||||
Number = 1,
|
||||
DateTime = 2,
|
||||
SingleSelect = 3,
|
||||
MultiSelect = 4,
|
||||
Checkbox = 5,
|
||||
}
|
||||
|
||||
impl std::default::Default for FieldType {
|
||||
fn default() -> Self {
|
||||
FieldType::RichText
|
||||
}
|
||||
}
|
||||
|
||||
impl AsRef<FieldType> for FieldType {
|
||||
fn as_ref(&self) -> &FieldType {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&FieldType> for FieldType {
|
||||
fn from(field_type: &FieldType) -> Self {
|
||||
field_type.clone()
|
||||
}
|
||||
}
|
||||
|
||||
impl FieldType {
|
||||
pub fn type_id(&self) -> String {
|
||||
let ty = self.clone();
|
||||
format!("{}", ty as u8)
|
||||
}
|
||||
|
||||
pub fn default_cell_width(&self) -> i32 {
|
||||
match self {
|
||||
FieldType::DateTime => 180,
|
||||
_ => 150,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default, ProtoBuf)]
|
||||
pub struct AnyData {
|
||||
#[pb(index = 1)]
|
||||
pub type_id: String,
|
||||
|
||||
#[pb(index = 2)]
|
||||
pub value: Vec<u8>,
|
||||
}
|
||||
|
||||
impl AnyData {
|
||||
pub fn from_str<F: Into<FieldType>>(field_type: F, s: &str) -> AnyData {
|
||||
Self::from_bytes(field_type, s.as_bytes().to_vec())
|
||||
}
|
||||
|
||||
pub fn from_bytes<T: AsRef<[u8]>, F: Into<FieldType>>(field_type: F, bytes: T) -> AnyData {
|
||||
AnyData {
|
||||
type_id: field_type.into().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, Clone, Default, PartialEq, Eq, Serialize, Deserialize, ProtoBuf)]
|
||||
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct RowMeta {
|
||||
#[pb(index = 1)]
|
||||
pub id: String,
|
||||
|
||||
#[pb(index = 2)]
|
||||
pub block_id: String,
|
||||
|
||||
#[pb(index = 3)]
|
||||
/// cells contains key/value pairs.
|
||||
/// key: field id,
|
||||
/// value: CellMeta
|
||||
pub cells: HashMap<String, CellMeta>,
|
||||
|
||||
#[pb(index = 4)]
|
||||
#[serde(with = "indexmap::serde_seq")]
|
||||
pub cells: IndexMap<String, CellMeta>,
|
||||
pub height: i32,
|
||||
|
||||
#[pb(index = 5)]
|
||||
pub visibility: bool,
|
||||
}
|
||||
|
||||
@ -345,24 +161,16 @@ impl RowMeta {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, ProtoBuf)]
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct RowMetaChangeset {
|
||||
#[pb(index = 1)]
|
||||
pub row_id: String,
|
||||
|
||||
#[pb(index = 2, one_of)]
|
||||
pub height: Option<i32>,
|
||||
|
||||
#[pb(index = 3, one_of)]
|
||||
pub visibility: Option<bool>,
|
||||
|
||||
#[pb(index = 4)]
|
||||
pub cell_by_field_id: HashMap<String, CellMeta>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize, ProtoBuf)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
|
||||
pub struct CellMeta {
|
||||
#[pb(index = 1)]
|
||||
pub data: String,
|
||||
}
|
||||
|
||||
@ -372,49 +180,27 @@ impl CellMeta {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, ProtoBuf)]
|
||||
pub struct CellMetaChangeset {
|
||||
#[pb(index = 1)]
|
||||
pub grid_id: String,
|
||||
|
||||
#[pb(index = 2)]
|
||||
pub row_id: String,
|
||||
|
||||
#[pb(index = 3)]
|
||||
pub field_id: String,
|
||||
|
||||
#[pb(index = 4, one_of)]
|
||||
pub data: Option<String>,
|
||||
#[derive(Clone, Deserialize, Serialize)]
|
||||
pub struct BuildGridContext {
|
||||
pub field_metas: Vec<FieldMeta>,
|
||||
pub block_meta: GridBlockMeta,
|
||||
pub block_meta_data: GridBlockMetaData,
|
||||
}
|
||||
|
||||
impl std::convert::From<CellMetaChangeset> for RowMetaChangeset {
|
||||
fn from(changeset: CellMetaChangeset) -> Self {
|
||||
let mut cell_by_field_id = HashMap::with_capacity(1);
|
||||
let field_id = changeset.field_id;
|
||||
let cell_meta = CellMeta {
|
||||
data: changeset.data.unwrap_or_else(|| "".to_owned()),
|
||||
};
|
||||
cell_by_field_id.insert(field_id, cell_meta);
|
||||
|
||||
RowMetaChangeset {
|
||||
row_id: changeset.row_id,
|
||||
height: None,
|
||||
visibility: None,
|
||||
cell_by_field_id,
|
||||
}
|
||||
impl std::convert::From<BuildGridContext> for Bytes {
|
||||
fn from(ctx: BuildGridContext) -> Self {
|
||||
let bytes = serde_json::to_vec(&ctx).unwrap_or_else(|_| vec![]);
|
||||
Bytes::from(bytes)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, ProtoBuf)]
|
||||
pub struct BuildGridContext {
|
||||
#[pb(index = 1)]
|
||||
pub field_metas: Vec<FieldMeta>,
|
||||
impl std::convert::TryFrom<Bytes> for BuildGridContext {
|
||||
type Error = serde_json::Error;
|
||||
|
||||
#[pb(index = 2)]
|
||||
pub block_meta: GridBlockMeta,
|
||||
|
||||
#[pb(index = 3)]
|
||||
pub block_meta_data: GridBlockMetaData,
|
||||
fn try_from(bytes: Bytes) -> Result<Self, Self::Error> {
|
||||
let ctx: BuildGridContext = serde_json::from_slice(&bytes)?;
|
||||
Ok(ctx)
|
||||
}
|
||||
}
|
||||
|
||||
impl std::default::Default for BuildGridContext {
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -3,6 +3,3 @@
|
||||
|
||||
mod grid;
|
||||
pub use grid::*;
|
||||
|
||||
mod meta;
|
||||
pub use meta::*;
|
||||
|
@ -1,5 +1,4 @@
|
||||
syntax = "proto3";
|
||||
import "meta.proto";
|
||||
|
||||
message Grid {
|
||||
string id = 1;
|
||||
@ -113,3 +112,28 @@ message QueryGridBlocksPayload {
|
||||
string grid_id = 1;
|
||||
repeated GridBlockOrder block_orders = 2;
|
||||
}
|
||||
message FieldChangesetPayload {
|
||||
string field_id = 1;
|
||||
string grid_id = 2;
|
||||
oneof one_of_name { string name = 3; };
|
||||
oneof one_of_desc { string desc = 4; };
|
||||
oneof one_of_field_type { FieldType field_type = 5; };
|
||||
oneof one_of_frozen { bool frozen = 6; };
|
||||
oneof one_of_visibility { bool visibility = 7; };
|
||||
oneof one_of_width { int32 width = 8; };
|
||||
oneof one_of_type_option_data { bytes type_option_data = 9; };
|
||||
}
|
||||
message CellChangeset {
|
||||
string grid_id = 1;
|
||||
string row_id = 2;
|
||||
string field_id = 3;
|
||||
oneof one_of_data { string data = 4; };
|
||||
}
|
||||
enum FieldType {
|
||||
RichText = 0;
|
||||
Number = 1;
|
||||
DateTime = 2;
|
||||
SingleSelect = 3;
|
||||
MultiSelect = 4;
|
||||
Checkbox = 5;
|
||||
}
|
||||
|
@ -1,76 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
message GridMeta {
|
||||
string grid_id = 1;
|
||||
repeated FieldMeta fields = 2;
|
||||
repeated GridBlockMeta blocks = 3;
|
||||
}
|
||||
message GridBlockMeta {
|
||||
string block_id = 1;
|
||||
int32 start_row_index = 2;
|
||||
int32 row_count = 3;
|
||||
}
|
||||
message GridBlockMetaData {
|
||||
string block_id = 1;
|
||||
repeated RowMeta rows = 2;
|
||||
}
|
||||
message FieldMeta {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
string desc = 3;
|
||||
FieldType field_type = 4;
|
||||
bool frozen = 5;
|
||||
bool visibility = 6;
|
||||
int32 width = 7;
|
||||
map<string, string> type_options = 8;
|
||||
}
|
||||
message FieldChangesetPayload {
|
||||
string field_id = 1;
|
||||
string grid_id = 2;
|
||||
oneof one_of_name { string name = 3; };
|
||||
oneof one_of_desc { string desc = 4; };
|
||||
oneof one_of_field_type { FieldType field_type = 5; };
|
||||
oneof one_of_frozen { bool frozen = 6; };
|
||||
oneof one_of_visibility { bool visibility = 7; };
|
||||
oneof one_of_width { int32 width = 8; };
|
||||
oneof one_of_type_option_data { bytes type_option_data = 9; };
|
||||
}
|
||||
message AnyData {
|
||||
string type_id = 1;
|
||||
bytes value = 2;
|
||||
}
|
||||
message RowMeta {
|
||||
string id = 1;
|
||||
string block_id = 2;
|
||||
map<string, CellMeta> cells = 3;
|
||||
int32 height = 4;
|
||||
bool visibility = 5;
|
||||
}
|
||||
message RowMetaChangeset {
|
||||
string row_id = 1;
|
||||
oneof one_of_height { int32 height = 2; };
|
||||
oneof one_of_visibility { bool visibility = 3; };
|
||||
map<string, CellMeta> cell_by_field_id = 4;
|
||||
}
|
||||
message CellMeta {
|
||||
string data = 1;
|
||||
}
|
||||
message CellMetaChangeset {
|
||||
string grid_id = 1;
|
||||
string row_id = 2;
|
||||
string field_id = 3;
|
||||
oneof one_of_data { string data = 4; };
|
||||
}
|
||||
message BuildGridContext {
|
||||
repeated FieldMeta field_metas = 1;
|
||||
GridBlockMeta block_meta = 2;
|
||||
GridBlockMetaData block_meta_data = 3;
|
||||
}
|
||||
enum FieldType {
|
||||
RichText = 0;
|
||||
Number = 1;
|
||||
DateTime = 2;
|
||||
SingleSelect = 3;
|
||||
MultiSelect = 4;
|
||||
Checkbox = 5;
|
||||
}
|
@ -166,7 +166,7 @@ impl GridBlockMetaPad {
|
||||
tracing::debug!("[GridBlockMeta] Composing delta {}", delta.to_delta_str());
|
||||
tracing::debug!(
|
||||
"[GridBlockMeta] current delta: {}",
|
||||
self.delta.to_str().unwrap_or("".to_string())
|
||||
self.delta.to_str().unwrap_or_else(|_| "".to_string())
|
||||
);
|
||||
self.delta = self.delta.compose(&delta)?;
|
||||
Ok(Some(GridBlockMetaChange { delta, md5: self.md5() }))
|
||||
@ -255,7 +255,8 @@ mod tests {
|
||||
visibility: false,
|
||||
};
|
||||
|
||||
let change = pad.add_row_meta(row, None).unwrap().unwrap();
|
||||
let change = pad.add_row_meta(row.clone(), None).unwrap().unwrap();
|
||||
assert_eq!(pad.rows.first().unwrap().as_ref(), &row);
|
||||
assert_eq!(
|
||||
change.delta.to_delta_str(),
|
||||
r#"[{"retain":24},{"insert":"{\"id\":\"1\",\"block_id\":\"1\",\"cells\":{},\"height\":0,\"visibility\":false}"},{"retain":2}]"#
|
||||
@ -384,7 +385,7 @@ mod tests {
|
||||
|
||||
assert_eq!(
|
||||
pad.to_json().unwrap(),
|
||||
r#"{"block_id":"1","rows":[{"id":"1","block_id":"1","cells":{},"height":100,"visibility":true}]}"#
|
||||
r#"{"block_id":"1","rows":[{"id":"1","block_id":"1","cells":[],"height":100,"visibility":true}]}"#
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user