Skip to content

Commit 1c8536d

Browse files
committed
feat(fr):v1.13.6
1 parent a4e8995 commit 1c8536d

File tree

2 files changed

+2
-58
lines changed

2 files changed

+2
-58
lines changed

Diff for: packages/form-render/src/form-render-core/src/core/RenderChildren/RenderList/CardList.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const CardList = ({
4545
className={`fr-card-item ${
4646
displayType === 'row' ? 'fr-card-item-row' : ''
4747
}`}
48-
key={Date.now()}
48+
key={idx}
4949
>
5050
<div className="fr-card-index">{idx + 1}</div>
5151
<Core {...fieldsProps} />

Diff for: packages/form-render/src/form-render-core/src/core/RenderChildren/RenderList/TabList.js

+1-57
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/* eslint-disable jsx-a11y/anchor-is-valid */
22
import React, { useState, useRef } from 'react';
33
import { Tabs } from 'antd';
4-
import { DndProvider, useDrag, useDrop } from 'react-dnd';
5-
import { HTML5Backend } from 'react-dnd-html5-backend';
64
import Core from '../../index';
75

86
const { TabPane } = Tabs;
@@ -52,40 +50,6 @@ const DraggableTabNode = ({ index, children, moveNode }) => {
5250
);
5351
};
5452

55-
const DraggableTabs = props => {
56-
const { children, changeList, displayList } = props;
57-
58-
const moveTabNode = (dragKey, hoverKey) => {
59-
let newDisplayList = displayList.slice();
60-
newDisplayList.splice(dragKey, 1);
61-
newDisplayList.splice(hoverKey, 0, displayList[dragKey]);
62-
63-
changeList(newDisplayList);
64-
};
65-
66-
const renderTabBar = (tabBarProps, DefaultTabBar) => (
67-
<DefaultTabBar {...tabBarProps}>
68-
{node => (
69-
<DraggableTabNode
70-
key={node.key}
71-
index={node.key}
72-
moveNode={moveTabNode}
73-
>
74-
{node}
75-
</DraggableTabNode>
76-
)}
77-
</DefaultTabBar>
78-
);
79-
80-
return (
81-
<DndProvider backend={HTML5Backend}>
82-
<Tabs renderTabBar={renderTabBar} {...props}>
83-
{children}
84-
</Tabs>
85-
</DndProvider>
86-
);
87-
};
88-
8953
const TabList = ({
9054
displayList = [],
9155
listData,
@@ -122,27 +86,7 @@ const TabList = ({
12286
: `${tabName || '项目'} ${idx + 1}`;
12387
};
12488

125-
return draggable ? (
126-
<DraggableTabs
127-
type={type || 'line'}
128-
onChange={setActiveKey}
129-
activeKey={activeKey}
130-
onEdit={onEdit}
131-
changeList={changeList}
132-
displayList={displayList}
133-
{...restProps}
134-
>
135-
{displayList.map((item, idx) => {
136-
const fieldsProps = getFieldsProps(idx);
137-
fieldsProps.displayType = displayType;
138-
return (
139-
<TabPane tab={getCurrentTabPaneName(idx)} key={`${idx}`}>
140-
<Core {...fieldsProps} />
141-
</TabPane>
142-
);
143-
})}
144-
</DraggableTabs>
145-
) : (
89+
return (
14690
<Tabs
14791
type={type || 'line'}
14892
onChange={setActiveKey}

0 commit comments

Comments
 (0)