schlechtenburg/packages/core/lib/types.ts

38 lines
760 B
TypeScript
Raw Normal View History

2021-03-08 15:29:35 +00:00
import { Component } from 'vue';
export interface ITreeNode {
2021-03-08 15:29:35 +00:00
id: string;
name: string;
icon?: string;
children: ITreeNode[];
2021-03-08 15:29:35 +00:00
}
export interface IBlockData<T> {
2021-03-08 15:29:35 +00:00
id: string;
name: string;
data: T;
}
export interface IBlockProps<T> {
2021-03-08 15:29:35 +00:00
blockId: string;
data?: T,
onUpdate?: (b?: IBlockData<T>) => void;
onPrependBlock?: (b?: IBlockData<T>) => void;
onAppendBlock?: (b?: IBlockData<T>) => void;
2021-03-08 15:29:35 +00:00
onRemoveSelf?: () => void;
onActivateNext?: () => void;
onActivatePrevious?: () => void;
}
export interface IBlockDefinition<T> {
2021-03-08 15:29:35 +00:00
name: string;
icon?: string;
getDefaultData: T;
edit: Component<IBlockProps<T>>;
display: Component<IBlockProps<T>>;
2021-03-08 15:29:35 +00:00
}
export interface IBlockLibrary {
[name: string]: IBlockDefinition<any>;
2021-03-08 15:29:35 +00:00
}