mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 11:58:10 +08:00
Cards 拖拽排序报错修复、支持自定义拖拽图标
This commit is contained in:
parent
3b4c4cea73
commit
5a3651adb7
@ -617,6 +617,7 @@ export default class Cards extends React.Component<GridProps, object> {
|
|||||||
|
|
||||||
destroyDragging() {
|
destroyDragging() {
|
||||||
this.sortable && this.sortable.destroy();
|
this.sortable && this.sortable.destroy();
|
||||||
|
this.sortable = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderActions(region: string) {
|
renderActions(region: string) {
|
||||||
@ -848,7 +849,14 @@ export default class Cards extends React.Component<GridProps, object> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderDragToggler() {
|
renderDragToggler() {
|
||||||
const {store, multiple, selectable, env, translate: __} = this.props;
|
const {
|
||||||
|
store,
|
||||||
|
multiple,
|
||||||
|
selectable,
|
||||||
|
env,
|
||||||
|
translate: __,
|
||||||
|
dragIcon
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
if (!store.draggable || store.items.length < 2) {
|
if (!store.draggable || store.items.length < 2) {
|
||||||
return null;
|
return null;
|
||||||
@ -868,9 +876,14 @@ export default class Cards extends React.Component<GridProps, object> {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
store.toggleDragging();
|
store.toggleDragging();
|
||||||
store.dragging && store.clear();
|
store.dragging && store.clear();
|
||||||
|
store.dragging ? this.initDragging() : undefined;
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Icon icon="exchange" className="icon r90" />
|
{React.isValidElement(dragIcon) ? (
|
||||||
|
dragIcon
|
||||||
|
) : (
|
||||||
|
<Icon icon="exchange" className="icon r90" />
|
||||||
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -904,9 +917,11 @@ export default class Cards extends React.Component<GridProps, object> {
|
|||||||
className: cx((card && card.className) || '', {
|
className: cx((card && card.className) || '', {
|
||||||
'is-checked': item.checked,
|
'is-checked': item.checked,
|
||||||
'is-modified': item.modified,
|
'is-modified': item.modified,
|
||||||
'is-moved': item.moved
|
'is-moved': item.moved,
|
||||||
|
'drag-mode': store.dragging
|
||||||
}),
|
}),
|
||||||
item,
|
item,
|
||||||
|
key: index,
|
||||||
itemIndex: item.index,
|
itemIndex: item.index,
|
||||||
multiple,
|
multiple,
|
||||||
selectable: store.selectable,
|
selectable: store.selectable,
|
||||||
|
Loading…
Reference in New Issue
Block a user