Skip to content

Commit

Permalink
fix: transfer table mode 列显示信息丢失 (#2659)
Browse files Browse the repository at this point in the history
Co-authored-by: wenyushan <wenyushan@xiaomi.com>
  • Loading branch information
sanmiao11 and wenyushan authored Oct 9, 2021
1 parent a08f5e2 commit 218c3c9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/Transfer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ export class Transfer extends React.Component<TransferProps, TransferState> {
selectMode,
noResultsText,
searchResultColumns,
columns,
classnames: cx,
value,
disabled,
Expand All @@ -286,12 +287,13 @@ export class Transfer extends React.Component<TransferProps, TransferState> {
} = this.props;
const options = this.state.searchResult || [];
const mode = searchResultMode || selectMode;
const resultColumns = searchResultColumns || columns;

return mode === 'table' ? (
<TableCheckboxes
placeholder={noResultsText}
className={cx('Transfer-checkboxes')}
columns={searchResultColumns!}
columns={resultColumns!}
options={options}
value={value}
disabled={disabled}
Expand Down
7 changes: 7 additions & 0 deletions src/renderers/Form/Transfer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ export interface TransferControlSchema extends FormOptionsControl {
*/
columns?: Array<any>;

/**
* 当 searchResultMode 为 table 时定义表格列信息。
*/
searchResultColumns?: Array<any>;

/**
* 可搜索?
*/
Expand Down Expand Up @@ -252,6 +257,7 @@ export class BaseTransferRenderer<
loading,
searchable,
searchResultMode,
searchResultColumns,
deferLoad,
leftOptions,
leftMode,
Expand All @@ -275,6 +281,7 @@ export class BaseTransferRenderer<
showArrow={showArrow}
selectMode={selectMode}
searchResultMode={searchResultMode}
searchResultColumns={searchResultColumns}
columns={columns}
onSearch={searchable ? this.handleSearch : undefined}
onDeferLoad={deferLoad}
Expand Down

0 comments on commit 218c3c9

Please sign in to comment.