feat(web): 替换amis渲染,amis渲染太慢,导致卡顿
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import {PlusCircleFilled, SaveFilled} from '@ant-design/icons'
|
import {DeleteFilled, EditFilled, PlusCircleFilled, SaveFilled} from '@ant-design/icons'
|
||||||
import {
|
import {
|
||||||
addEdge,
|
addEdge,
|
||||||
applyEdgeChanges,
|
applyEdgeChanges,
|
||||||
@@ -19,13 +19,12 @@ import {
|
|||||||
} from '@xyflow/react'
|
} from '@xyflow/react'
|
||||||
import {useMount} from 'ahooks'
|
import {useMount} from 'ahooks'
|
||||||
import type {Schema} from 'amis'
|
import type {Schema} from 'amis'
|
||||||
import {Button, Dropdown, message} from 'antd'
|
import {Button, Card, Dropdown, message, Popover} from 'antd'
|
||||||
import {arrToMap, contain, find, isEqual, isNil, randomId} from 'licia'
|
import {arrToMap, contain, find, isEqual, randomId} from 'licia'
|
||||||
import {type JSX, useState} from 'react'
|
import {type JSX, useState} from 'react'
|
||||||
import styled from 'styled-components'
|
import styled from 'styled-components'
|
||||||
import '@xyflow/react/dist/style.css'
|
import '@xyflow/react/dist/style.css'
|
||||||
import {create} from 'zustand/react'
|
import {create} from 'zustand/react'
|
||||||
import {amisRender, commonInfo} from '../util/amis.tsx'
|
|
||||||
|
|
||||||
const FlowableDiv = styled.div`
|
const FlowableDiv = styled.div`
|
||||||
height: 93vh;
|
height: 93vh;
|
||||||
@@ -48,8 +47,8 @@ const AmisNode = (
|
|||||||
const {id, data} = props
|
const {id, data} = props
|
||||||
const {setDataById} = data
|
const {setDataById} = data
|
||||||
return (
|
return (
|
||||||
<div className="p-1 w-80">
|
<div className="p-1 w-72">
|
||||||
{amisRender(
|
{/*{amisRender(
|
||||||
{
|
{
|
||||||
type: 'card',
|
type: 'card',
|
||||||
header: {
|
header: {
|
||||||
@@ -87,7 +86,23 @@ const AmisNode = (
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)}
|
)}*/}
|
||||||
|
<Popover
|
||||||
|
content={
|
||||||
|
<EditFilled/>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Card
|
||||||
|
size="small"
|
||||||
|
actions={[
|
||||||
|
<EditFilled key="edit"/>,
|
||||||
|
<DeleteFilled key="remove"/>,
|
||||||
|
]}
|
||||||
|
hoverable
|
||||||
|
>
|
||||||
|
<Card.Meta title={name} description={description}/>
|
||||||
|
</Card>
|
||||||
|
</Popover>
|
||||||
{isEqual(type, 'start') || isEqual(type, 'normal')
|
{isEqual(type, 'start') || isEqual(type, 'normal')
|
||||||
? <Handle type="source" position={Position.Right}/> : undefined}
|
? <Handle type="source" position={Position.Right}/> : undefined}
|
||||||
{isEqual(type, 'end') || isEqual(type, 'normal')
|
{isEqual(type, 'end') || isEqual(type, 'normal')
|
||||||
|
|||||||
Reference in New Issue
Block a user