Skip to content

Commit 14bca37

Browse files
committed
fix(examples): 修复 engine-browser-examples 中类型错误问题
1 parent df729da commit 14bca37

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

examples/engine-browser-examples/src/pages/graph/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export default function BasicNode() {
118118
]
119119

120120
map(elements, (customElement) => {
121-
lf.register(customElement)
121+
lf.register(customElement as LogicFlow.RegisterConfig)
122122
})
123123
}
124124
const registerEvents = (lf: LogicFlow) => {
@@ -261,7 +261,7 @@ export default function BasicNode() {
261261
const handleRefreshGraph = () => {
262262
const lf = lfRef.current
263263
if (lf) {
264-
const data = lf.getGraphData()
264+
const data = lf.getGraphRawData()
265265
console.log('current graph data', data)
266266
const refreshData = LogicFlowUtil.refreshGraphId(data)
267267
console.log('after refresh graphId', data)
@@ -288,15 +288,15 @@ export default function BasicNode() {
288288

289289
const handleTurnAnimationOn = () => {
290290
if (lfRef.current) {
291-
const { edges } = lfRef.current.getGraphData() as GraphConfigData
291+
const { edges } = lfRef.current.getGraphRawData()
292292
forEach(edges, (edge) => {
293293
lfRef.current?.openEdgeAnimation(edge.id)
294294
})
295295
}
296296
}
297297
const handleTurnAnimationOff = () => {
298298
if (lfRef.current) {
299-
const { edges } = lfRef.current.getGraphData() as GraphConfigData
299+
const { edges } = lfRef.current.getGraphRawData()
300300
forEach(edges, (edge) => {
301301
lfRef.current?.closeEdgeAnimation(edge.id)
302302
})

examples/engine-browser-examples/src/pages/graph/nodes/combine.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
import { h, BaseNode, BaseNodeModel } from '@logicflow/core'
1+
import { h, BaseNode, BaseNodeModel, GraphModel } from '@logicflow/core'
22

3-
export class CombineNode extends BaseNode {
3+
export type ICombineNodeProps = {
4+
model: CombineModel
5+
graphModel: GraphModel
6+
}
7+
8+
export class CombineNode extends BaseNode<ICombineNodeProps> {
49
getShape() {
510
const { x, y } = this.props.model
611
const { fill } = this.props.model.getNodeStyle()

examples/engine-browser-examples/src/pages/graph/nodes/uml.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class UmlModel extends HtmlNodeModel {
3232
}
3333
}
3434
export class UmlNode extends HtmlNode {
35-
setHtml(rootEl: HTMLElement) {
35+
setHtml(rootEl: SVGForeignObjectElement) {
3636
const { properties } = this.props.model
3737
const el = document.createElement('div')
3838
el.className = 'uml-wrapper'

packages/core/src/LogicFlow.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,7 +1403,7 @@ export namespace LogicFlow {
14031403
}
14041404
export type Point = {
14051405
id?: string
1406-
[key: string]: any
1406+
[key: string]: any // TODO: 确认这个属性是干什么的呢?是有可以移除
14071407
} & Position
14081408
export type PointTuple = [number, number]
14091409
export type ClientPosition = {
@@ -1435,7 +1435,7 @@ export namespace LogicFlow {
14351435
value: string
14361436
editable?: boolean
14371437
draggable?: boolean
1438-
} & Point
1438+
} & Position
14391439

14401440
export type AppendConfig = {
14411441
startIndex: number

0 commit comments

Comments
 (0)