mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 10:59:42 +08:00
fix: transfer 结果搜索默认提示语句错误
This commit is contained in:
parent
7558fa28ee
commit
842b8cc08a
@ -21,6 +21,7 @@ export interface ResultListProps extends ThemeProps, LocaleProps {
|
||||
sortable?: boolean;
|
||||
disabled?: boolean;
|
||||
title?: string;
|
||||
searchPlaceholder?: string;
|
||||
placeholder: string;
|
||||
itemRender: (option: Option, states: ItemRenderStates) => JSX.Element;
|
||||
itemClassName?: string;
|
||||
@ -225,7 +226,8 @@ export class ResultList extends React.Component<
|
||||
itemClassName,
|
||||
sortable,
|
||||
labelField,
|
||||
translate: __
|
||||
translate: __,
|
||||
placeholder
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
@ -272,7 +274,7 @@ export class ResultList extends React.Component<
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<div className={cx('Selections-placeholder')}>{__('Transfer.selectFromLeft')}</div>
|
||||
<div className={cx('Selections-placeholder')}>{__(placeholder)}</div>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
@ -286,7 +288,7 @@ export class ResultList extends React.Component<
|
||||
searchable,
|
||||
value,
|
||||
translate: __,
|
||||
placeholder = __('Transfer.searchKeyword')
|
||||
searchPlaceholder
|
||||
} = this.props;
|
||||
|
||||
const {searchResult} = this.state;
|
||||
@ -296,7 +298,7 @@ export class ResultList extends React.Component<
|
||||
{title ? <div className={cx('Selections-title')}>{title}</div> : null}
|
||||
{searchable ? (
|
||||
<TransferSearch
|
||||
placeholder={placeholder}
|
||||
placeholder={searchPlaceholder}
|
||||
onSearch={this.search}
|
||||
onCancelSearch={this.clearSearch}
|
||||
/>
|
||||
|
@ -17,6 +17,7 @@ import TableSelection from './TableSelection';
|
||||
|
||||
export interface ResultTableSelectionProps extends BaseSelectionProps {
|
||||
title?: string;
|
||||
searchPlaceholder?: string;
|
||||
placeholder?: string;
|
||||
searchable?: boolean;
|
||||
onSearch?: Function;
|
||||
@ -195,7 +196,7 @@ export class BaseResultTableSelection extends BaseSelection<
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<div className={cx('Selections-placeholder')}>{__('Transfer.selectFromLeft')}</div>
|
||||
<div className={cx('Selections-placeholder')}>{__(placeholder)}</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
@ -208,7 +209,7 @@ export class BaseResultTableSelection extends BaseSelection<
|
||||
title,
|
||||
searchable,
|
||||
translate: __,
|
||||
placeholder = __('Transfer.searchKeyword')
|
||||
searchPlaceholder
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
@ -216,7 +217,7 @@ export class BaseResultTableSelection extends BaseSelection<
|
||||
{title ? <div className={cx('Selections-title')}>{title}</div> : null}
|
||||
{searchable ? (
|
||||
<TransferSearch
|
||||
placeholder={placeholder}
|
||||
placeholder={searchPlaceholder}
|
||||
onSearch={this.search}
|
||||
onCancelSearch={this.clearSearch}
|
||||
/>
|
||||
|
@ -2,7 +2,7 @@
|
||||
* 结果树(暂时不支持结果排序)
|
||||
*/
|
||||
import React from 'react';
|
||||
import {cloneDeep, isEqual, omit} from 'lodash';
|
||||
import _, {cloneDeep, isEqual, omit} from 'lodash';
|
||||
|
||||
import {Option, Options} from './Select';
|
||||
import {ThemeProps, themeable} from 'amis-core';
|
||||
@ -24,6 +24,7 @@ export interface ResultTreeListProps
|
||||
onSearch?: Function;
|
||||
onChange: (value: Array<Option>, optionModified?: boolean) => void;
|
||||
placeholder: string;
|
||||
searchPlaceholder?: string;
|
||||
itemRender: (option: Option, states: ItemRenderStates) => JSX.Element;
|
||||
itemClassName?: string;
|
||||
cellRender?: (
|
||||
@ -256,7 +257,8 @@ export class BaseResultTreeList extends React.Component<
|
||||
value,
|
||||
valueField,
|
||||
itemRender,
|
||||
translate: __
|
||||
translate: __,
|
||||
placeholder
|
||||
} = this.props;
|
||||
|
||||
const {treeOptions, searching, searchTreeOptions} = this.state;
|
||||
@ -276,7 +278,7 @@ export class BaseResultTreeList extends React.Component<
|
||||
onDelete={(option: Option) => this.deleteTreeChecked(option)}
|
||||
/>
|
||||
) : (
|
||||
<div className={cx('Selections-placeholder')}>{__('Transfer.selectFromLeft')}</div>
|
||||
<div className={cx('Selections-placeholder')}>{__(placeholder)}</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
@ -289,7 +291,7 @@ export class BaseResultTreeList extends React.Component<
|
||||
title,
|
||||
searchable,
|
||||
translate: __,
|
||||
placeholder = __('Transfer.searchKeyword')
|
||||
searchPlaceholder
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
@ -297,7 +299,7 @@ export class BaseResultTreeList extends React.Component<
|
||||
{title ? <div className={cx('Selections-title')}>{title}</div> : null}
|
||||
{searchable ? (
|
||||
<TransferSearch
|
||||
placeholder={placeholder}
|
||||
placeholder={searchPlaceholder}
|
||||
onSearch={this.search}
|
||||
onCancelSearch={this.clearSearch}
|
||||
/>
|
||||
|
@ -630,15 +630,13 @@ export class Transfer<
|
||||
onResultSearch,
|
||||
sortable,
|
||||
labelField,
|
||||
translate: __
|
||||
translate: __,
|
||||
placeholder = __('Transfer.selectFromLeft')
|
||||
} = this.props;
|
||||
|
||||
const {resultSelectMode, isTreeDeferLoad} = this.state;
|
||||
const searchable = !isTreeDeferLoad && resultSearchable;
|
||||
|
||||
const placeholder =
|
||||
resultSearchPlaceholder || __('Transfer.searchKeyword');
|
||||
|
||||
switch (resultSelectMode) {
|
||||
case 'table':
|
||||
return (
|
||||
@ -654,6 +652,7 @@ export class Transfer<
|
||||
multiple={false}
|
||||
searchable={searchable}
|
||||
placeholder={placeholder}
|
||||
searchPlaceholder={resultSearchPlaceholder}
|
||||
onSearch={onResultSearch}
|
||||
/>
|
||||
);
|
||||
@ -669,6 +668,7 @@ export class Transfer<
|
||||
itemRender={resultItemRender}
|
||||
searchable={searchable}
|
||||
placeholder={placeholder}
|
||||
searchPlaceholder={resultSearchPlaceholder}
|
||||
onSearch={onResultSearch}
|
||||
labelField={labelField}
|
||||
/>
|
||||
@ -682,6 +682,7 @@ export class Transfer<
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
placeholder={placeholder}
|
||||
searchPlaceholder={resultSearchPlaceholder}
|
||||
itemRender={resultItemRender}
|
||||
searchable={searchable}
|
||||
onSearch={onResultSearch}
|
||||
|
@ -35,10 +35,6 @@ export class TransferSearch extends React.Component<
|
||||
return <span>{`${option.scopeLabel || ''}${option.label}`}</span>;
|
||||
}
|
||||
|
||||
static defaultProps: Pick<TransferSearchProps, 'placeholder'> = {
|
||||
placeholder: 'placeholder.selectData'
|
||||
};
|
||||
|
||||
state: TransferSearchState = {
|
||||
inputValue: ''
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user