Skip to content

Commit

Permalink
fix(examples): 修复 engine-browser-examples 中类型错误问题
Browse files Browse the repository at this point in the history
  • Loading branch information
boyongjiong committed Jul 2, 2024
1 parent df729da commit 14bca37
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
8 changes: 4 additions & 4 deletions examples/engine-browser-examples/src/pages/graph/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export default function BasicNode() {
]

map(elements, (customElement) => {
lf.register(customElement)
lf.register(customElement as LogicFlow.RegisterConfig)
})
}
const registerEvents = (lf: LogicFlow) => {
Expand Down Expand Up @@ -261,7 +261,7 @@ export default function BasicNode() {
const handleRefreshGraph = () => {
const lf = lfRef.current
if (lf) {
const data = lf.getGraphData()
const data = lf.getGraphRawData()
console.log('current graph data', data)
const refreshData = LogicFlowUtil.refreshGraphId(data)
console.log('after refresh graphId', data)
Expand All @@ -288,15 +288,15 @@ export default function BasicNode() {

const handleTurnAnimationOn = () => {
if (lfRef.current) {
const { edges } = lfRef.current.getGraphData() as GraphConfigData
const { edges } = lfRef.current.getGraphRawData()
forEach(edges, (edge) => {
lfRef.current?.openEdgeAnimation(edge.id)
})
}
}
const handleTurnAnimationOff = () => {
if (lfRef.current) {
const { edges } = lfRef.current.getGraphData() as GraphConfigData
const { edges } = lfRef.current.getGraphRawData()
forEach(edges, (edge) => {
lfRef.current?.closeEdgeAnimation(edge.id)
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { h, BaseNode, BaseNodeModel } from '@logicflow/core'
import { h, BaseNode, BaseNodeModel, GraphModel } from '@logicflow/core'

export class CombineNode extends BaseNode {
export type ICombineNodeProps = {
model: CombineModel
graphModel: GraphModel
}

export class CombineNode extends BaseNode<ICombineNodeProps> {
getShape() {
const { x, y } = this.props.model
const { fill } = this.props.model.getNodeStyle()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class UmlModel extends HtmlNodeModel {
}
}
export class UmlNode extends HtmlNode {
setHtml(rootEl: HTMLElement) {
setHtml(rootEl: SVGForeignObjectElement) {
const { properties } = this.props.model
const el = document.createElement('div')
el.className = 'uml-wrapper'
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/LogicFlow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1403,7 +1403,7 @@ export namespace LogicFlow {
}
export type Point = {
id?: string
[key: string]: any
[key: string]: any // TODO: 确认这个属性是干什么的呢?是有可以移除
} & Position
export type PointTuple = [number, number]
export type ClientPosition = {
Expand Down Expand Up @@ -1435,7 +1435,7 @@ export namespace LogicFlow {
value: string
editable?: boolean
draggable?: boolean
} & Point
} & Position

export type AppendConfig = {
startIndex: number
Expand Down

0 comments on commit 14bca37

Please sign in to comment.