fix: transfer selectTitle resultTitle not work (#1957)

* fix: transfer selectTitle resultTitle not work

* feat: selectTitle resultTitle use translate
This commit is contained in:
GGICE 2021-05-14 14:35:24 +08:00 committed by GitHub
parent 875a5e48c2
commit bad661528a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 10 deletions

View File

@ -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>
};

View File

@ -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}

View File

@ -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} />

View File

@ -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} />