mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-04 19:15:33 +08:00
3939cc1c52
close: BS-2630, BS-2631, BS-2629, BS-2632, BS-2635
42 lines
955 B
TypeScript
42 lines
955 B
TypeScript
import type { Text } from '@blocksuite/store';
|
|
import {
|
|
BlockModel,
|
|
BlockSchemaExtension,
|
|
defineBlockSchema,
|
|
} from '@blocksuite/store';
|
|
|
|
import type {
|
|
ColumnDataType,
|
|
SerializedCells,
|
|
ViewBasicDataType,
|
|
} from './types.js';
|
|
|
|
export type DatabaseBlockProps = {
|
|
views: ViewBasicDataType[];
|
|
title: Text;
|
|
cells: SerializedCells;
|
|
columns: Array<ColumnDataType>;
|
|
};
|
|
|
|
export class DatabaseBlockModel extends BlockModel<DatabaseBlockProps> {}
|
|
|
|
export const DatabaseBlockSchema = defineBlockSchema({
|
|
flavour: 'affine:database',
|
|
props: (internal): DatabaseBlockProps => ({
|
|
views: [],
|
|
title: internal.Text(),
|
|
cells: Object.create(null),
|
|
columns: [],
|
|
}),
|
|
metadata: {
|
|
role: 'hub',
|
|
version: 3,
|
|
parent: ['affine:note'],
|
|
children: ['affine:paragraph', 'affine:list'],
|
|
},
|
|
toModel: () => new DatabaseBlockModel(),
|
|
});
|
|
|
|
export const DatabaseBlockSchemaExtension =
|
|
BlockSchemaExtension(DatabaseBlockSchema);
|