Skip to content

Commit bfcd07c

Browse files
committed
feat: Add PropertyTableEditor to ObjectPropertyView for improved property management and saving functionality
1 parent 5f3a0fd commit bfcd07c

5 files changed

Lines changed: 521 additions & 11 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"@electron-toolkit/preload": "^3.0.1",
2828
"@electron-toolkit/utils": "^4.0.0",
2929
"antd": "^5.26.0",
30+
"dayjs": "^1.11.13",
3031
"electron-updater": "^6.3.9",
3132
"html2canvas": "^1.4.1",
3233
"katex": "^0.16.11",

pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/renderer/src/components/pages/object/ObjectPropertyView.tsx

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Button, Typography, Card, Input, Space, Tooltip, Empty, Collapse } from
33
import { InfoCircleOutlined, EditOutlined, SaveOutlined, CloseOutlined } from '@ant-design/icons'
44
import { ObjectChat, ObjectNode as ObjectNodeType } from '../../../types'
55
import { useAppContext } from '../../../store/AppContext'
6+
import PropertyTableEditor from './PropertyTableEditor'
67

78
const { Title, Text } = Typography
89
const { TextArea } = Input
@@ -71,6 +72,20 @@ const ObjectPropertyView: React.FC<ObjectPropertyViewProps> = ({ chatId }) => {
7172
setEditValue('')
7273
}
7374

75+
// 保存属性
76+
const handlePropertiesSave = (properties: { [key: string]: any }) => {
77+
if (!selectedNode) return
78+
79+
dispatch({
80+
type: 'UPDATE_OBJECT_NODE',
81+
payload: {
82+
chatId: chat.id,
83+
nodeId: selectedNode.id,
84+
updates: { properties }
85+
}
86+
})
87+
}
88+
7489
// 格式化显示值
7590
const formatDisplayValue = (value: any): string => {
7691
if (value === null || value === undefined) {
@@ -189,16 +204,15 @@ const ObjectPropertyView: React.FC<ObjectPropertyViewProps> = ({ chatId }) => {
189204
</Card>
190205

191206
{/* 属性信息 */}
192-
{selectedNode.properties && Object.keys(selectedNode.properties).length > 0 && (
193-
<Card size="small" style={{ marginBottom: '16px' }}>
194-
<Title level={5} style={{ margin: '0 0 12px 0' }}>
195-
属性信息
196-
</Title>
197-
<div style={{ background: '#fafafa', padding: '12px', borderRadius: '4px' }}>
198-
{renderPropertyItem('属性', selectedNode.properties, 'properties', true)}
199-
</div>
200-
</Card>
201-
)}
207+
<Card size="small" style={{ marginBottom: '16px' }}>
208+
<Title level={5} style={{ margin: '0 0 12px 0' }}>
209+
属性信息
210+
</Title>
211+
<PropertyTableEditor
212+
properties={selectedNode.properties || {}}
213+
onSave={handlePropertiesSave}
214+
/>
215+
</Card>
202216

203217
{/* 元数据 */}
204218
{selectedNode.metadata && (

0 commit comments

Comments
 (0)