mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-03 04:28:32 +08:00
fix: transfer selectTitle
resultTitle
not work (#1957)
* fix: transfer selectTitle resultTitle not work * feat: selectTitle resultTitle use translate
This commit is contained in:
parent
875a5e48c2
commit
bad661528a
@ -31,8 +31,6 @@ export interface TabsTransferProps
|
||||
|
||||
export class TabsTransfer extends React.Component<TabsTransferProps> {
|
||||
static defaultProps = {
|
||||
selectTitle: 'Select.placeholder',
|
||||
resultTitle: 'Transfer.selectd',
|
||||
itemRender: (option: Option) => <span>{option.label}</span>
|
||||
};
|
||||
|
||||
|
@ -23,7 +23,7 @@ export interface TransferProps
|
||||
statistics?: boolean;
|
||||
showArrow?: boolean;
|
||||
|
||||
selectTitle: string;
|
||||
selectTitle?: string;
|
||||
selectMode?: 'table' | 'list' | 'tree' | 'chained' | 'associated';
|
||||
columns?: Array<{
|
||||
name: string;
|
||||
@ -68,7 +68,7 @@ export interface TransferProps
|
||||
}
|
||||
) => JSX.Element;
|
||||
|
||||
resultTitle: string;
|
||||
resultTitle?: string;
|
||||
sortable?: boolean;
|
||||
}
|
||||
|
||||
@ -79,8 +79,6 @@ export interface TransferState {
|
||||
|
||||
export class Transfer extends React.Component<TransferProps, TransferState> {
|
||||
static defaultProps = {
|
||||
selectTitle: 'Select.placeholder',
|
||||
resultTitle: 'Transfer.selectd',
|
||||
itemRender: (option: Option) => <span>{option.label}</span>
|
||||
};
|
||||
|
||||
@ -223,7 +221,7 @@ export class Transfer extends React.Component<TransferProps, TransferState> {
|
||||
)}
|
||||
>
|
||||
<span>
|
||||
{__(selectTitle)}
|
||||
{__(selectTitle || 'Select.placeholder')}
|
||||
{statistics !== false ? (
|
||||
<span>
|
||||
({this.valueArray.length}/{this.availableOptions.length})
|
||||
@ -449,7 +447,7 @@ export class Transfer extends React.Component<TransferProps, TransferState> {
|
||||
<div className={cx('Transfer-result')}>
|
||||
<div className={cx('Transfer-title')}>
|
||||
<span>
|
||||
{__(resultTitle)}
|
||||
{__(resultTitle || 'Transfer.selectd')}
|
||||
{statistics !== false ? (
|
||||
<span>
|
||||
({this.valueArray.length}/{this.availableOptions.length})
|
||||
|
@ -41,6 +41,16 @@ export interface TabsTransferControlSchema extends FormOptionsControl {
|
||||
* 搜索 API
|
||||
*/
|
||||
searchApi?: SchemaApi;
|
||||
|
||||
/**
|
||||
* 左侧的标题文字
|
||||
*/
|
||||
selectTitle?: string;
|
||||
|
||||
/**
|
||||
* 右侧结果的标题文字
|
||||
*/
|
||||
resultTitle?: string;
|
||||
}
|
||||
|
||||
export interface TabsTransferProps
|
||||
@ -70,7 +80,9 @@ export class TabsTransferRenderer extends BaseTransferRenderer<TabsTransferProps
|
||||
searchResultMode,
|
||||
showArrow,
|
||||
deferLoad,
|
||||
disabled
|
||||
disabled,
|
||||
selectTitle,
|
||||
resultTitle
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
@ -86,6 +98,8 @@ export class TabsTransferRenderer extends BaseTransferRenderer<TabsTransferProps
|
||||
onSearch={searchable ? this.handleSearch : undefined}
|
||||
showArrow={showArrow}
|
||||
onDeferLoad={deferLoad}
|
||||
selectTitle={selectTitle}
|
||||
resultTitle={resultTitle}
|
||||
/>
|
||||
|
||||
<Spinner overlay key="info" show={loading} />
|
||||
|
@ -76,6 +76,16 @@ export interface TransferControlSchema extends FormOptionsControl {
|
||||
* 搜索 API
|
||||
*/
|
||||
searchApi?: SchemaApi;
|
||||
|
||||
/**
|
||||
* 左侧的标题文字
|
||||
*/
|
||||
selectTitle?: string;
|
||||
|
||||
/**
|
||||
* 右侧结果的标题文字
|
||||
*/
|
||||
resultTitle?: string;
|
||||
}
|
||||
|
||||
export interface BaseTransferProps
|
||||
@ -243,7 +253,9 @@ export class BaseTransferRenderer<
|
||||
leftOptions,
|
||||
leftMode,
|
||||
rightMode,
|
||||
disabled
|
||||
disabled,
|
||||
selectTitle,
|
||||
resultTitle
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
@ -265,6 +277,8 @@ export class BaseTransferRenderer<
|
||||
leftMode={leftMode}
|
||||
rightMode={rightMode}
|
||||
cellRender={this.renderCell}
|
||||
selectTitle={selectTitle}
|
||||
resultTitle={resultTitle}
|
||||
/>
|
||||
|
||||
<Spinner overlay key="info" show={loading} />
|
||||
|
Loading…
Reference in New Issue
Block a user