mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
@ -13,7 +13,7 @@ class DatabaseCell {
|
||||
/// We use [fieldId + rowId] to identify the cell.
|
||||
class CellCacheKey {
|
||||
final String fieldId;
|
||||
final Int64 rowId;
|
||||
final RowId rowId;
|
||||
CellCacheKey({
|
||||
required this.fieldId,
|
||||
required this.rowId,
|
||||
@ -28,7 +28,7 @@ class CellCache {
|
||||
final String viewId;
|
||||
|
||||
/// fieldId: {cacheKey: GridCell}
|
||||
final Map<String, Map<Int64, dynamic>> _cellDataByFieldId = {};
|
||||
final Map<String, Map<RowId, dynamic>> _cellDataByFieldId = {};
|
||||
CellCache({
|
||||
required this.viewId,
|
||||
});
|
||||
|
@ -1,11 +1,11 @@
|
||||
import 'dart:async';
|
||||
import 'package:appflowy/plugins/database_view/application/field/field_listener.dart';
|
||||
import 'package:appflowy/plugins/database_view/application/row/row_service.dart';
|
||||
import 'package:appflowy_backend/log.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-database2/field_entities.pbenum.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:fixnum/fixnum.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import '../field/field_controller.dart';
|
||||
import '../field/field_service.dart';
|
||||
@ -39,7 +39,7 @@ class CellController<T, D> extends Equatable {
|
||||
|
||||
String get viewId => cellId.viewId;
|
||||
|
||||
Int64 get rowId => cellId.rowId;
|
||||
RowId get rowId => cellId.rowId;
|
||||
|
||||
String get fieldId => cellId.fieldInfo.id;
|
||||
|
||||
|
@ -2,15 +2,16 @@ import 'package:appflowy/core/grid_notification.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-database2/notification.pb.dart';
|
||||
import 'package:fixnum/fixnum.dart';
|
||||
import 'package:flowy_infra/notifier.dart';
|
||||
import 'dart:async';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import '../row/row_service.dart';
|
||||
|
||||
typedef UpdateFieldNotifiedValue = Either<Unit, FlowyError>;
|
||||
|
||||
class CellListener {
|
||||
final Int64 rowId;
|
||||
final RowId rowId;
|
||||
final String fieldId;
|
||||
PublishNotifier<UpdateFieldNotifiedValue>? _updateCellNotifier =
|
||||
PublishNotifier();
|
||||
|
@ -9,12 +9,12 @@ import 'package:appflowy_backend/log.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-database2/cell_entities.pb.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-database2/field_entities.pb.dart';
|
||||
import 'package:fixnum/fixnum.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'dart:convert' show utf8;
|
||||
|
||||
import '../field/field_controller.dart';
|
||||
import '../row/row_service.dart';
|
||||
part 'cell_service.freezed.dart';
|
||||
part 'cell_data_loader.dart';
|
||||
part 'cell_cache.dart';
|
||||
@ -52,7 +52,7 @@ class CellBackendService {
|
||||
class CellIdentifier with _$CellIdentifier {
|
||||
const factory CellIdentifier({
|
||||
required String viewId,
|
||||
required Int64 rowId,
|
||||
required RowId rowId,
|
||||
required FieldInfo fieldInfo,
|
||||
}) = _CellIdentifier;
|
||||
|
||||
|
@ -13,12 +13,12 @@ import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'dart:async';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:fixnum/fixnum.dart';
|
||||
import 'database_view_service.dart';
|
||||
import 'defines.dart';
|
||||
import 'layout/layout_setting_listener.dart';
|
||||
import 'row/row_cache.dart';
|
||||
import 'group/group_listener.dart';
|
||||
import 'row/row_service.dart';
|
||||
|
||||
typedef OnGroupByField = void Function(List<GroupPB>);
|
||||
typedef OnUpdateGroup = void Function(List<GroupPB>);
|
||||
@ -157,7 +157,7 @@ class DatabaseController {
|
||||
}
|
||||
|
||||
Future<Either<RowPB, FlowyError>> createRow({
|
||||
Int64? startRowId,
|
||||
RowId? startRowId,
|
||||
String? groupId,
|
||||
void Function(RowDataBuilder builder)? withCells,
|
||||
}) {
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:appflowy/plugins/database_view/application/row/row_service.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-database2/calendar_entities.pb.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-database2/database_entities.pb.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-database2/group_changeset.pb.dart';
|
||||
@ -9,7 +10,6 @@ import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-database2/field_entities.pb.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-database2/group.pb.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-database2/row_entities.pb.dart';
|
||||
import 'package:fixnum/fixnum.dart';
|
||||
|
||||
class DatabaseViewBackendService {
|
||||
final String viewId;
|
||||
@ -25,12 +25,12 @@ class DatabaseViewBackendService {
|
||||
}
|
||||
|
||||
Future<Either<RowPB, FlowyError>> createRow({
|
||||
Int64? startRowId,
|
||||
RowId? startRowId,
|
||||
String? groupId,
|
||||
Map<String, String>? cellDataByFieldId,
|
||||
}) {
|
||||
var payload = CreateRowPayloadPB.create()..viewId = viewId;
|
||||
payload.startRowId = startRowId ?? Int64(0);
|
||||
payload.startRowId = startRowId ?? "";
|
||||
|
||||
if (groupId != null) {
|
||||
payload.groupId = groupId;
|
||||
@ -44,9 +44,9 @@ class DatabaseViewBackendService {
|
||||
}
|
||||
|
||||
Future<Either<Unit, FlowyError>> moveRow({
|
||||
required Int64 fromRowId,
|
||||
required RowId fromRowId,
|
||||
required String toGroupId,
|
||||
Int64? toRowId,
|
||||
RowId? toRowId,
|
||||
}) {
|
||||
var payload = MoveGroupRowPayloadPB.create()
|
||||
..viewId = viewId
|
||||
|
@ -2,22 +2,22 @@ import 'dart:collection';
|
||||
|
||||
import 'package:appflowy_backend/protobuf/flowy-database2/database_entities.pb.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
|
||||
import 'package:fixnum/fixnum.dart';
|
||||
|
||||
import '../grid/presentation/widgets/filter/filter_info.dart';
|
||||
import 'field/field_controller.dart';
|
||||
import 'row/row_cache.dart';
|
||||
import 'row/row_service.dart';
|
||||
|
||||
typedef OnFieldsChanged = void Function(UnmodifiableListView<FieldInfo>);
|
||||
typedef OnFiltersChanged = void Function(List<FilterInfo>);
|
||||
typedef OnDatabaseChanged = void Function(DatabasePB);
|
||||
|
||||
typedef OnRowsCreated = void Function(List<Int64> ids);
|
||||
typedef OnRowsUpdated = void Function(List<Int64> ids);
|
||||
typedef OnRowsDeleted = void Function(List<Int64> ids);
|
||||
typedef OnRowsCreated = void Function(List<RowId> ids);
|
||||
typedef OnRowsUpdated = void Function(List<RowId> ids);
|
||||
typedef OnRowsDeleted = void Function(List<RowId> ids);
|
||||
typedef OnRowsChanged = void Function(
|
||||
UnmodifiableListView<RowInfo> rows,
|
||||
UnmodifiableMapView<Int64, RowInfo> rowByRowId,
|
||||
UnmodifiableMapView<RowId, RowInfo> rowByRowId,
|
||||
RowsChangedReason reason,
|
||||
);
|
||||
|
||||
|
@ -2,13 +2,13 @@ import 'dart:collection';
|
||||
import 'package:appflowy_backend/dispatch/dispatch.dart';
|
||||
import 'package:appflowy_backend/log.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart';
|
||||
import 'package:fixnum/fixnum.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import '../cell/cell_service.dart';
|
||||
import '../field/field_controller.dart';
|
||||
import 'row_list.dart';
|
||||
import 'row_service.dart';
|
||||
part 'row_cache.freezed.dart';
|
||||
|
||||
typedef RowUpdateCallback = void Function();
|
||||
@ -43,7 +43,7 @@ class RowCache {
|
||||
return UnmodifiableListView(visibleRows);
|
||||
}
|
||||
|
||||
UnmodifiableMapView<Int64, RowInfo> get rowByRowId {
|
||||
UnmodifiableMapView<RowId, RowInfo> get rowByRowId {
|
||||
return UnmodifiableMapView(_rowList.rowInfoByRowId);
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ class RowCache {
|
||||
});
|
||||
}
|
||||
|
||||
RowInfo? getRow(Int64 rowId) {
|
||||
RowInfo? getRow(RowId rowId) {
|
||||
return _rowList.get(rowId);
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ class RowCache {
|
||||
}
|
||||
}
|
||||
|
||||
void _deleteRows(List<Int64> deletedRowIds) {
|
||||
void _deleteRows(List<RowId> deletedRowIds) {
|
||||
for (final rowId in deletedRowIds) {
|
||||
final deletedRow = _rowList.remove(rowId);
|
||||
if (deletedRow != null) {
|
||||
@ -157,7 +157,7 @@ class RowCache {
|
||||
}
|
||||
}
|
||||
|
||||
void _hideRows(List<Int64> invisibleRows) {
|
||||
void _hideRows(List<RowId> invisibleRows) {
|
||||
for (final rowId in invisibleRows) {
|
||||
final deletedRow = _rowList.remove(rowId);
|
||||
if (deletedRow != null) {
|
||||
@ -184,7 +184,7 @@ class RowCache {
|
||||
}
|
||||
|
||||
RowUpdateCallback addListener({
|
||||
required Int64 rowId,
|
||||
required RowId rowId,
|
||||
void Function(CellByFieldId, RowsChangedReason)? onCellUpdated,
|
||||
bool Function()? listenWhen,
|
||||
}) {
|
||||
@ -220,7 +220,7 @@ class RowCache {
|
||||
_rowChangeReasonNotifier.removeListener(callback);
|
||||
}
|
||||
|
||||
CellByFieldId loadGridCells(Int64 rowId) {
|
||||
CellByFieldId loadGridCells(RowId rowId) {
|
||||
final RowPB? data = _rowList.get(rowId)?.rowPB;
|
||||
if (data == null) {
|
||||
_loadRow(rowId);
|
||||
@ -228,7 +228,7 @@ class RowCache {
|
||||
return _makeGridCells(rowId, data);
|
||||
}
|
||||
|
||||
Future<void> _loadRow(Int64 rowId) async {
|
||||
Future<void> _loadRow(RowId rowId) async {
|
||||
final payload = RowIdPB.create()
|
||||
..viewId = viewId
|
||||
..rowId = rowId;
|
||||
@ -240,7 +240,7 @@ class RowCache {
|
||||
);
|
||||
}
|
||||
|
||||
CellByFieldId _makeGridCells(Int64 rowId, RowPB? row) {
|
||||
CellByFieldId _makeGridCells(RowId rowId, RowPB? row) {
|
||||
// ignore: prefer_collection_literals
|
||||
var cellDataMap = CellByFieldId();
|
||||
for (final field in _delegate.fields) {
|
||||
@ -320,7 +320,7 @@ typedef InsertedIndexs = List<InsertedIndex>;
|
||||
typedef DeletedIndexs = List<DeletedIndex>;
|
||||
// key: id of the row
|
||||
// value: UpdatedIndex
|
||||
typedef UpdatedIndexMap = LinkedHashMap<Int64, UpdatedIndex>;
|
||||
typedef UpdatedIndexMap = LinkedHashMap<RowId, UpdatedIndex>;
|
||||
|
||||
@freezed
|
||||
class RowsChangedReason with _$RowsChangedReason {
|
||||
@ -338,7 +338,7 @@ class RowsChangedReason with _$RowsChangedReason {
|
||||
|
||||
class InsertedIndex {
|
||||
final int index;
|
||||
final Int64 rowId;
|
||||
final RowId rowId;
|
||||
InsertedIndex({
|
||||
required this.index,
|
||||
required this.rowId,
|
||||
@ -356,7 +356,7 @@ class DeletedIndex {
|
||||
|
||||
class UpdatedIndex {
|
||||
final int index;
|
||||
final Int64 rowId;
|
||||
final RowId rowId;
|
||||
UpdatedIndex({
|
||||
required this.index,
|
||||
required this.rowId,
|
||||
|
@ -1,12 +1,12 @@
|
||||
import 'package:fixnum/fixnum.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import '../cell/cell_service.dart';
|
||||
import 'row_cache.dart';
|
||||
import 'row_service.dart';
|
||||
|
||||
typedef OnRowChanged = void Function(CellByFieldId, RowsChangedReason);
|
||||
|
||||
class RowController {
|
||||
final Int64 rowId;
|
||||
final RowId rowId;
|
||||
final String viewId;
|
||||
final List<VoidCallback> _onRowChangedListeners = [];
|
||||
final RowCache _rowCache;
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'dart:collection';
|
||||
import 'package:appflowy_backend/protobuf/flowy-database2/row_entities.pb.dart';
|
||||
import 'package:fixnum/fixnum.dart';
|
||||
import 'row_cache.dart';
|
||||
import 'row_service.dart';
|
||||
|
||||
class RowList {
|
||||
/// Use List to reverse the order of the row.
|
||||
@ -10,13 +10,13 @@ class RowList {
|
||||
List<RowInfo> get rows => List.from(_rowInfos);
|
||||
|
||||
/// Use Map for faster access the raw row data.
|
||||
final HashMap<Int64, RowInfo> rowInfoByRowId = HashMap();
|
||||
final HashMap<RowId, RowInfo> rowInfoByRowId = HashMap();
|
||||
|
||||
RowInfo? get(Int64 rowId) {
|
||||
RowInfo? get(RowId rowId) {
|
||||
return rowInfoByRowId[rowId];
|
||||
}
|
||||
|
||||
int? indexOfRow(Int64 rowId) {
|
||||
int? indexOfRow(RowId rowId) {
|
||||
final rowInfo = rowInfoByRowId[rowId];
|
||||
if (rowInfo != null) {
|
||||
return _rowInfos.indexOf(rowInfo);
|
||||
@ -57,7 +57,7 @@ class RowList {
|
||||
}
|
||||
}
|
||||
|
||||
DeletedIndex? remove(Int64 rowId) {
|
||||
DeletedIndex? remove(RowId rowId) {
|
||||
final rowInfo = rowInfoByRowId[rowId];
|
||||
if (rowInfo != null) {
|
||||
final index = _rowInfos.indexOf(rowInfo);
|
||||
@ -146,7 +146,7 @@ class RowList {
|
||||
}
|
||||
}
|
||||
|
||||
void moveRow(Int64 rowId, int oldIndex, int newIndex) {
|
||||
void moveRow(RowId rowId, int oldIndex, int newIndex) {
|
||||
final index = _rowInfos.indexWhere(
|
||||
(rowInfo) => rowInfo.rowPB.id == rowId,
|
||||
);
|
||||
@ -157,7 +157,7 @@ class RowList {
|
||||
}
|
||||
}
|
||||
|
||||
bool contains(Int64 rowId) {
|
||||
bool contains(RowId rowId) {
|
||||
return rowInfoByRowId[rowId] != null;
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,8 @@ import 'package:dartz/dartz.dart';
|
||||
import 'package:appflowy_backend/dispatch/dispatch.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-database2/row_entities.pb.dart';
|
||||
import 'package:fixnum/fixnum.dart';
|
||||
|
||||
typedef RowId = String;
|
||||
|
||||
class RowBackendService {
|
||||
final String viewId;
|
||||
@ -11,7 +12,7 @@ class RowBackendService {
|
||||
required this.viewId,
|
||||
});
|
||||
|
||||
Future<Either<RowPB, FlowyError>> createRow(Int64 rowId) {
|
||||
Future<Either<RowPB, FlowyError>> createRow(RowId rowId) {
|
||||
final payload = CreateRowPayloadPB.create()
|
||||
..viewId = viewId
|
||||
..startRowId = rowId;
|
||||
@ -19,7 +20,7 @@ class RowBackendService {
|
||||
return DatabaseEventCreateRow(payload).send();
|
||||
}
|
||||
|
||||
Future<Either<OptionalRowPB, FlowyError>> getRow(Int64 rowId) {
|
||||
Future<Either<OptionalRowPB, FlowyError>> getRow(RowId rowId) {
|
||||
final payload = RowIdPB.create()
|
||||
..viewId = viewId
|
||||
..rowId = rowId;
|
||||
@ -27,7 +28,7 @@ class RowBackendService {
|
||||
return DatabaseEventGetRow(payload).send();
|
||||
}
|
||||
|
||||
Future<Either<Unit, FlowyError>> deleteRow(Int64 rowId) {
|
||||
Future<Either<Unit, FlowyError>> deleteRow(RowId rowId) {
|
||||
final payload = RowIdPB.create()
|
||||
..viewId = viewId
|
||||
..rowId = rowId;
|
||||
@ -35,7 +36,7 @@ class RowBackendService {
|
||||
return DatabaseEventDeleteRow(payload).send();
|
||||
}
|
||||
|
||||
Future<Either<Unit, FlowyError>> duplicateRow(Int64 rowId) {
|
||||
Future<Either<Unit, FlowyError>> duplicateRow(RowId rowId) {
|
||||
final payload = RowIdPB.create()
|
||||
..viewId = viewId
|
||||
..rowId = rowId;
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'dart:async';
|
||||
import 'dart:collection';
|
||||
import 'package:appflowy/plugins/database_view/application/row/row_service.dart';
|
||||
import 'package:appflowy_backend/log.dart';
|
||||
import 'package:fixnum/fixnum.dart';
|
||||
import '../defines.dart';
|
||||
import '../field/field_controller.dart';
|
||||
import '../row/row_cache.dart';
|
||||
@ -40,7 +40,7 @@ class DatabaseViewCache {
|
||||
UnmodifiableListView<RowInfo> get rowInfos => _rowCache.rowInfos;
|
||||
RowCache get rowCache => _rowCache;
|
||||
|
||||
RowInfo? getRow(Int64 rowId) => _rowCache.getRow(rowId);
|
||||
RowInfo? getRow(RowId rowId) => _rowCache.getRow(rowId);
|
||||
|
||||
DatabaseViewCache({
|
||||
required this.viewId,
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'dart:async';
|
||||
import 'dart:collection';
|
||||
|
||||
import 'package:appflowy/plugins/database_view/application/row/row_service.dart';
|
||||
import 'package:appflowy_board/appflowy_board.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
@ -8,7 +9,6 @@ import 'package:appflowy_backend/log.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart';
|
||||
import 'package:fixnum/fixnum.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
@ -311,7 +311,7 @@ class BoardEvent with _$BoardEvent {
|
||||
GroupPB group,
|
||||
RowPB row,
|
||||
) = _StartEditRow;
|
||||
const factory BoardEvent.endEditingRow(Int64 rowId) = _EndEditRow;
|
||||
const factory BoardEvent.endEditingRow(RowId rowId) = _EndEditRow;
|
||||
const factory BoardEvent.didReceiveError(FlowyError error) = _DidReceiveError;
|
||||
const factory BoardEvent.didReceiveGridUpdate(
|
||||
DatabasePB grid,
|
||||
@ -423,7 +423,7 @@ class GroupControllerDelegateImpl extends GroupControllerDelegate {
|
||||
}
|
||||
|
||||
@override
|
||||
void removeRow(GroupPB group, Int64 rowId) {
|
||||
void removeRow(GroupPB group, RowId rowId) {
|
||||
controller.removeGroupItem(group.groupId, rowId.toString());
|
||||
}
|
||||
|
||||
|
@ -1,17 +1,17 @@
|
||||
import 'package:appflowy/plugins/database_view/application/row/row_service.dart';
|
||||
import 'package:appflowy_backend/log.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:appflowy/core/grid_notification.dart';
|
||||
import 'package:fixnum/fixnum.dart';
|
||||
import 'package:flowy_infra/notifier.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
|
||||
typedef OnGroupError = void Function(FlowyError);
|
||||
|
||||
abstract class GroupControllerDelegate {
|
||||
void removeRow(GroupPB group, Int64 rowId);
|
||||
void removeRow(GroupPB group, RowId rowId);
|
||||
void insertRow(GroupPB group, RowPB row, int? index);
|
||||
void updateRow(GroupPB group, RowPB row);
|
||||
void addNewRow(GroupPB group, RowPB row, int? index);
|
||||
|
@ -1,5 +1,6 @@
|
||||
import 'package:appflowy/plugins/database_view/application/cell/cell_service.dart';
|
||||
import 'package:appflowy/plugins/database_view/application/field/field_controller.dart';
|
||||
import 'package:appflowy/plugins/database_view/application/row/row_service.dart';
|
||||
import 'package:appflowy_backend/dispatch/dispatch.dart';
|
||||
import 'package:appflowy_backend/log.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-error/protobuf.dart';
|
||||
@ -7,7 +8,6 @@ import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart';
|
||||
import 'package:calendar_view/calendar_view.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:fixnum/fixnum.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
@ -83,7 +83,7 @@ class CalendarBloc extends Bloc<CalendarEvent, CalendarState> {
|
||||
),
|
||||
);
|
||||
},
|
||||
didDeleteEvents: (List<Int64> deletedRowIds) {
|
||||
didDeleteEvents: (List<RowId> deletedRowIds) {
|
||||
var events = [...state.allEvents];
|
||||
events.retainWhere(
|
||||
(element) => !deletedRowIds.contains(element.event!.cellId.rowId),
|
||||
@ -165,7 +165,7 @@ class CalendarBloc extends Bloc<CalendarEvent, CalendarState> {
|
||||
return _databaseController.updateCalenderLayoutSetting(layoutSetting);
|
||||
}
|
||||
|
||||
Future<CalendarEventData<CalendarDayEvent>?> _loadEvent(Int64 rowId) async {
|
||||
Future<CalendarEventData<CalendarDayEvent>?> _loadEvent(RowId rowId) async {
|
||||
final payload = RowIdPB(viewId: viewId, rowId: rowId);
|
||||
return DatabaseEventGetCalendarEvent(payload).send().then((result) {
|
||||
return result.fold(
|
||||
@ -324,7 +324,7 @@ class CalendarEvent with _$CalendarEvent {
|
||||
) = _DidReceiveNewEvent;
|
||||
|
||||
// Called when deleting events
|
||||
const factory CalendarEvent.didDeleteEvents(List<Int64> rowIds) =
|
||||
const factory CalendarEvent.didDeleteEvents(List<RowId> rowIds) =
|
||||
_DidDeleteEvents;
|
||||
|
||||
// Called when creating a new event
|
||||
@ -351,7 +351,7 @@ class CalendarState with _$CalendarState {
|
||||
required Events allEvents,
|
||||
required Events initialEvents,
|
||||
CalendarEventData<CalendarDayEvent>? newEvent,
|
||||
required List<Int64> deleteEventIds,
|
||||
required List<RowId> deleteEventIds,
|
||||
CalendarEventData<CalendarDayEvent>? updateEvent,
|
||||
required Option<CalendarLayoutSettingPB> settings,
|
||||
required DatabaseLoadingState loadingState,
|
||||
@ -391,6 +391,6 @@ class CalendarDayEvent {
|
||||
final CalendarEventPB event;
|
||||
final CellIdentifier cellId;
|
||||
|
||||
Int64 get eventId => cellId.rowId;
|
||||
RowId get eventId => cellId.rowId;
|
||||
CalendarDayEvent({required this.cellId, required this.event});
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import 'package:equatable/equatable.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart';
|
||||
import 'package:fixnum/fixnum.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import '../../application/field/field_controller.dart';
|
||||
@ -66,7 +65,7 @@ class GridBloc extends Bloc<GridEvent, GridState> {
|
||||
return super.close();
|
||||
}
|
||||
|
||||
RowCache? getRowCache(Int64 rowId) {
|
||||
RowCache? getRowCache(RowId rowId) {
|
||||
return databaseController.rowCache;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'package:appflowy/plugins/database_view/application/cell/cell_service.dart';
|
||||
import 'package:appflowy/plugins/database_view/application/row/row_service.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-database2/field_entities.pbenum.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-database2/select_option.pb.dart';
|
||||
import 'package:fixnum/fixnum.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
typedef CellRenderHook<C, T> = Widget? Function(C cellData, T cardData);
|
||||
@ -122,7 +122,7 @@ abstract class EditableCell {
|
||||
|
||||
class EditableCellId {
|
||||
String fieldId;
|
||||
Int64 rowId;
|
||||
RowId rowId;
|
||||
|
||||
EditableCellId(this.rowId, this.fieldId);
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
import 'package:appflowy/plugins/database_view/application/cell/cell_service.dart';
|
||||
import 'package:appflowy/plugins/database_view/application/field/type_option/type_option_service.dart';
|
||||
import 'package:appflowy/plugins/database_view/application/row/row_service.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-database2/select_option.pb.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:appflowy_backend/dispatch/dispatch.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-database2/cell_entities.pb.dart';
|
||||
import 'package:fixnum/fixnum.dart';
|
||||
|
||||
class SelectOptionBackendService {
|
||||
final CellIdentifier cellId;
|
||||
@ -13,7 +13,7 @@ class SelectOptionBackendService {
|
||||
|
||||
String get viewId => cellId.viewId;
|
||||
String get fieldId => cellId.fieldInfo.id;
|
||||
Int64 get rowId => cellId.rowId;
|
||||
RowId get rowId => cellId.rowId;
|
||||
|
||||
Future<Either<Unit, FlowyError>> create({
|
||||
required String name,
|
||||
|
Reference in New Issue
Block a user