|
@@ -6,15 +6,15 @@ import {
|
|
|
OptionalRowPB,
|
|
|
RowsChangesetPB,
|
|
|
RowsVisibilityChangesetPB,
|
|
|
- ReorderSingleRowPB,
|
|
|
-} from '@/services/backend';
|
|
|
-import { ChangeNotifier } from '$app/utils/change_notifier';
|
|
|
-import { FieldInfo } from '../field/field_controller';
|
|
|
-import { CellCache, CellCacheKey } from '../cell/cell_cache';
|
|
|
-import { CellIdentifier } from '../cell/cell_bd_svc';
|
|
|
-import { DatabaseEventGetRow } from '@/services/backend/events/flowy-database2';
|
|
|
-import { None, Option, Some } from 'ts-results';
|
|
|
-import { Log } from '$app/utils/log';
|
|
|
+ ReorderSingleRowPB
|
|
|
+} from "@/services/backend";
|
|
|
+import { ChangeNotifier } from "$app/utils/change_notifier";
|
|
|
+import { FieldInfo } from "../field/field_controller";
|
|
|
+import { CellCache, CellCacheKey } from "../cell/cell_cache";
|
|
|
+import { CellIdentifier } from "../cell/cell_bd_svc";
|
|
|
+import { DatabaseEventGetRow } from "@/services/backend/events/flowy-database2";
|
|
|
+import { None, Option, Some } from "ts-results";
|
|
|
+import { Log } from "$app/utils/log";
|
|
|
|
|
|
export type CellByFieldId = Map<string, CellIdentifier>;
|
|
|
|
|
@@ -56,7 +56,7 @@ export class RowCache {
|
|
|
subscribe = (callbacks: {
|
|
|
onRowsChanged: (reason: RowChangedReason, cellMap?: Map<string, CellIdentifier>) => void;
|
|
|
}) => {
|
|
|
- return this.notifier.observer.subscribe((change) => {
|
|
|
+ return this.notifier.observer?.subscribe((change) => {
|
|
|
if (change.rowId !== undefined) {
|
|
|
callbacks.onRowsChanged(change.reason, this._toCellMap(change.rowId, this.getFieldInfos()));
|
|
|
} else {
|
|
@@ -339,7 +339,8 @@ export class RowInfo {
|
|
|
public readonly viewId: string,
|
|
|
public readonly fieldInfos: readonly FieldInfo[],
|
|
|
public readonly row: RowPB
|
|
|
- ) {}
|
|
|
+ ) {
|
|
|
+ }
|
|
|
|
|
|
copyWith = (params: { row?: RowPB; fieldInfos?: readonly FieldInfo[] }) => {
|
|
|
return new RowInfo(this.viewId, params.fieldInfos || this.fieldInfos, params.row || this.row);
|
|
@@ -347,15 +348,18 @@ export class RowInfo {
|
|
|
}
|
|
|
|
|
|
export class DeletedRow {
|
|
|
- constructor(public readonly index: number, public readonly rowInfo: RowInfo) {}
|
|
|
+ constructor(public readonly index: number, public readonly rowInfo: RowInfo) {
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
export class InsertedRow {
|
|
|
- constructor(public readonly index: number, public readonly rowId: string) {}
|
|
|
+ constructor(public readonly index: number, public readonly rowId: string) {
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
export class RowChanged {
|
|
|
- constructor(public readonly reason: RowChangedReason, public readonly rowId?: string) {}
|
|
|
+ constructor(public readonly reason: RowChangedReason, public readonly rowId?: string) {
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// eslint-disable-next-line no-shadow
|