This commit is contained in:
lzp
2026-03-04 15:06:22 +08:00
parent 9817e5e0db
commit cee42d8b78
28 changed files with 340 additions and 84 deletions

View File

@@ -1,5 +1,5 @@
import { createId } from '../../tools/tools'
import { NODE_DATATYPE, NODE_COMPONENT } from '../tools/index.d'
import { NODE_DATATYPE, NODE_COMPONENT, NODE_DATATIER } from '../tools/index.d'
interface NodeOptions {
id?: string
position?: { x: number, y: number }
@@ -34,11 +34,12 @@ export class NodeManager {
const positionX = options.positionX || 0
const positionY = options.positionY || 0
const position = options.position ||
!snode ? { x: positionX, y: positionY } :
{
x: snode.position.x + snode.dimensions.width + 50 + positionX,
y: snode.position.y + positionY
}
(!snode ?
{ x: positionX, y: positionY } :
{
x: snode.position.x + snode.dimensions.width + 50 + positionX,
y: snode.position.y + positionY
})
const data = options?.data || {}
data['component'] = options.component
const options_ = {
@@ -55,7 +56,7 @@ export class NodeManager {
...(options ? options : {}),
component: NODE_COMPONENT.RESULT_IMAGE,
data: {
tier: 0,
tier: NODE_DATATIER.RESULT_IMAGE,
type: NODE_DATATYPE.RESULT_IMAGE,
isHeader: true,
...(options?.data || {}),
@@ -70,7 +71,7 @@ export class NodeManager {
component: NODE_COMPONENT.CARD,
positionY: 50,
data: {
tier: 1,
tier: NODE_DATATIER.CARDS_SELECT,
type: NODE_DATATYPE.CARDS_SELECT,
...(options?.data || {}),
},
@@ -82,6 +83,20 @@ export class NodeManager {
const options_ = {
...(options ? options : {}),
component: NODE_COMPONENT.CARD,
data: {
...(options?.data || {}),
}
}
return this.createNode(options_)
}
/** 创建文本节点 */
createTextNode(options?: NodeOptions) {
const options_ = {
...(options ? options : {}),
component: NODE_COMPONENT.TEXT,
data: {
...(options?.data || {}),
}
}
return this.createNode(options_)
}