Skip to content

Commit

Permalink
fix: When the component id is very long, the delete button of generat…
Browse files Browse the repository at this point in the history
…e will be hidden #1906 (#1907)

### What problem does this PR solve?
fix: When the component id is very long, the delete button of generate
will be hidden #1906

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
  • Loading branch information
cike8899 authored Aug 12, 2024
1 parent cafdee5 commit ad48e8d
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 35 deletions.
31 changes: 3 additions & 28 deletions web/src/assets/svg/llm/moonshot.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 7 additions & 4 deletions web/src/components/editable-cell.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Form, FormInstance, Input, InputRef } from 'antd';
import { Form, FormInstance, Input, InputRef, Typography } from 'antd';
import React, { useContext, useEffect, useRef, useState } from 'react';

const EditableContext = React.createContext<FormInstance<any> | null>(null);
const { Paragraph, Text } = Typography;

interface EditableRowProps {
index: number;
Expand Down Expand Up @@ -77,7 +78,7 @@ export const EditableCell: React.FC<EditableCellProps> = ({
if (editable) {
childNode = editing ? (
<Form.Item
style={{ margin: 0 }}
style={{ margin: 0, width: 100 }}
name={dataIndex}
rules={[
{
Expand All @@ -91,10 +92,12 @@ export const EditableCell: React.FC<EditableCellProps> = ({
) : (
<div
className="editable-cell-value-wrap"
style={{ paddingRight: 24 }}
// style={{ paddingRight: 24 }}
onClick={toggleEdit}
>
{children}
<Text ellipsis={{ tooltip: children }} style={{ width: 100 }}>
{children}
</Text>
</div>
);
}
Expand Down
2 changes: 1 addition & 1 deletion web/src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ The above is the content you need to summarize.`,
'15d': '12 days',
'30d': '30 days',
},
publish: 'Publish',
publish: 'API',
},
footer: {
profile: 'All rights reserved @ React',
Expand Down
2 changes: 1 addition & 1 deletion web/src/locales/zh-traditional.ts
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ export default {
'15d': '12天',
'30d': '30天',
},
publish: '發布',
publish: 'API',
},
footer: {
profile: '“保留所有權利 @ react”',
Expand Down
2 changes: 1 addition & 1 deletion web/src/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ export default {
'15d': '12天',
'30d': '30天',
},
publish: '发布',
publish: 'API',
},
footer: {
profile: 'All rights reserved @ React',
Expand Down
3 changes: 3 additions & 0 deletions web/src/pages/flow/generate-form/dynamic-parameters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const DynamicParameters = ({ nodeId }: IProps) => {
title: t('key'),
dataIndex: 'key',
key: 'key',
width: 50,
onCell: (record: IGenerateParameter) => ({
record,
editable: true,
Expand Down Expand Up @@ -69,6 +70,7 @@ const DynamicParameters = ({ nodeId }: IProps) => {
width: 20,
key: 'operation',
align: 'center',
fixed: 'right',
render(_, record) {
return <DeleteOutlined onClick={handleRemove(record.id)} />;
},
Expand All @@ -89,6 +91,7 @@ const DynamicParameters = ({ nodeId }: IProps) => {
className={styles.variableTable}
components={components}
rowClassName={() => styles.editableRow}
scroll={{ x: true }}
/>
</section>
);
Expand Down

0 comments on commit ad48e8d

Please sign in to comment.