2020-12-30 01:32:46 +00:00
|
|
|
import { Component } from 'vue';
|
|
|
|
|
2021-02-22 23:12:06 +00:00
|
|
|
export interface BlockTree {
|
2021-03-07 17:47:28 +00:00
|
|
|
id: string;
|
2021-02-22 23:12:06 +00:00
|
|
|
name: string;
|
|
|
|
icon?: string;
|
|
|
|
children?: BlockTree[];
|
|
|
|
}
|
|
|
|
|
2020-12-30 01:32:46 +00:00
|
|
|
export interface BlockDefinition {
|
|
|
|
name: string;
|
2021-02-22 23:12:06 +00:00
|
|
|
icon?: string;
|
2020-12-30 01:32:46 +00:00
|
|
|
getDefaultData: any;
|
|
|
|
edit: Component;
|
|
|
|
display: Component;
|
2021-02-22 23:12:06 +00:00
|
|
|
getChildren?: (block: Block) => Block[],
|
2020-12-30 01:32:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface BlockLibraryDefinition {
|
|
|
|
[name: string]: BlockDefinition;
|
|
|
|
}
|
|
|
|
|
2021-02-22 18:13:37 +00:00
|
|
|
export interface BlockProps {
|
2021-03-07 17:47:28 +00:00
|
|
|
id: string;
|
2021-02-22 18:13:37 +00:00
|
|
|
data: any;
|
2020-12-30 01:32:46 +00:00
|
|
|
}
|
|
|
|
|
2021-02-22 18:13:37 +00:00
|
|
|
export interface Block extends BlockProps {
|
2020-12-30 01:32:46 +00:00
|
|
|
name: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export const model = {
|
|
|
|
prop: 'block',
|
|
|
|
event: 'update',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const blockProps = {
|
2021-03-07 17:47:28 +00:00
|
|
|
id: {
|
2020-12-30 01:32:46 +00:00
|
|
|
type: String,
|
|
|
|
default: () => `${+(new Date())}`,
|
|
|
|
},
|
|
|
|
data: { type: Object, default: () => ({}) },
|
|
|
|
};
|