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