|
|
@ -17,31 +17,22 @@ export interface TransferItem { |
|
|
|
|
|
|
|
// Transfer
|
|
|
|
export interface TransferProps { |
|
|
|
/** 数据源 */ |
|
|
|
dataSource: Array<TransferItem>; |
|
|
|
/** 每行数据渲染函数 */ |
|
|
|
render?: (record: TransferItem) => any; |
|
|
|
/** 显示在右侧框数据的key集合 */ |
|
|
|
targetKeys: Array<string>; |
|
|
|
/** 变化时回调函数 */ |
|
|
|
onChange?: (targetKeys: Array<TransferItem>, direction: string, moveKeys: any) => void; |
|
|
|
/** 两个穿梭框的自定义样式 */ |
|
|
|
listStyle?: React.CSSProperties; |
|
|
|
/** 自定义类*/ |
|
|
|
className?: string; |
|
|
|
/** 标题集合,顺序从左至右 */ |
|
|
|
prefixCls?: string; |
|
|
|
titles?: Array<string>; |
|
|
|
/** 操作文案集合,顺序从上至下 */ |
|
|
|
operations?: Array<string>; |
|
|
|
/** 是否显示搜索框 */ |
|
|
|
showSearch?: boolean; |
|
|
|
/** 搜索框的默认值 */ |
|
|
|
searchPlaceholder?: string; |
|
|
|
/** 当列表为空时显示的内容 */ |
|
|
|
notFoundContent?: React.ReactNode | string; |
|
|
|
/** 底部渲染函数 */ |
|
|
|
footer?: (props: any) => any; |
|
|
|
style?: React.CSSProperties; |
|
|
|
filterOption: (filterText: any, item: any) => boolean; |
|
|
|
body?: (props: any) => any; |
|
|
|
} |
|
|
|
|
|
|
|
export default class Transfer extends React.Component<TransferProps, any> { |
|
|
@ -82,6 +73,8 @@ export default class Transfer extends React.Component<TransferProps, any> { |
|
|
|
rowKey: PropTypes.func, |
|
|
|
}; |
|
|
|
|
|
|
|
splitedDataSource: any; |
|
|
|
|
|
|
|
constructor(props) { |
|
|
|
super(props); |
|
|
|
this.state = { |
|
|
@ -176,8 +169,12 @@ export default class Transfer extends React.Component<TransferProps, any> { |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
handleLeftSelectAll = (...args) => this.handleSelectAll('left', ...args) |
|
|
|
handleRightSelectAll = (...args) => this.handleSelectAll('right', ...args) |
|
|
|
handleLeftSelectAll = (filteredDataSource, checkAll) => ( |
|
|
|
this.handleSelectAll('left', filteredDataSource, checkAll) |
|
|
|
) |
|
|
|
handleRightSelectAll = (filteredDataSource, checkAll) => ( |
|
|
|
this.handleSelectAll('right', filteredDataSource, checkAll) |
|
|
|
) |
|
|
|
|
|
|
|
handleFilter = (direction, e) => { |
|
|
|
this.setState({ |
|
|
|