Skip to content

Commit 11e190a

Browse files
twinkle77liujuping
authored andcommitted
fix: drag handler style overlap
1 parent 2ac2450 commit 11e190a

File tree

2 files changed

+7
-36
lines changed

2 files changed

+7
-36
lines changed

demo/src/index.ts

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,40 +8,7 @@ preference.set('DataSourcePane', {
88
importPlugins: [],
99
dataSourceTypes: [
1010
{
11-
type: 'fetch',
12-
// schema: {
13-
// type: "object",
14-
// properties: {
15-
// id: {
16-
// type: "string"
17-
// },
18-
// type: {
19-
// type: "string"
20-
// },
21-
// isInit: {
22-
// type: "boolean",
23-
// },
24-
// options: {
25-
// type: "object",
26-
// properties: {
27-
// method: {
28-
// type: "string",
29-
// },
30-
// isCors: {
31-
// type: "boolean",
32-
// },
33-
// timeout: {
34-
// type: "number",
35-
// },
36-
// uri: {
37-
// type: "string",
38-
// },
39-
// },
40-
// required: ["method", "isCors", "timeout", "uri"]
41-
// }
42-
// },
43-
// required: ["id", "type", "isInit", "options"]
44-
// }
11+
type: 'fetch'
4512
},
4613
{
4714
type: 'jsonp',

packages/plugin-datasource-pane/src/components/DataSourceListItem/DataSourceListItem.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ export class DataSourceListItem extends Component<DataSourceListItemProps> {
110110
selected,
111111
renderInfoTags = defaultRenderInfoTags,
112112
} = this.props;
113+
114+
// 拖拽中,需要向右偏移 8p,避免覆盖
115+
const offsetStyle = mode === DataSourcePanelMode.SORTING ? { marginLeft: '8px' } : null;
116+
113117
return this.props?.connectDropTarget?.(
114118
this.props?.connectDragPreview?.(
115119
<div
@@ -137,7 +141,7 @@ export class DataSourceListItem extends Component<DataSourceListItemProps> {
137141
onChange={this.handleExportCheckChange}
138142
/>
139143
)}
140-
<div className={generateClassName('list-item-title')}>
144+
<div className={generateClassName('list-item-title')} style={offsetStyle}>
141145
<div
142146
className={generateClassName('list-item-id')}
143147
title={dataSource.id}
@@ -165,7 +169,7 @@ export class DataSourceListItem extends Component<DataSourceListItemProps> {
165169
</div>
166170
}
167171
</div>
168-
<div className={generateClassName('list-item-desc')}>
172+
<div className={generateClassName('list-item-desc')} style={offsetStyle}>
169173
{renderInfoTags(dataSource)?.map?.((tag: DataSourceInfoTag) => {
170174
if (tag.tooltip === true) {
171175
return (

0 commit comments

Comments
 (0)