Commit a2cecbaf authored by zhangwenshuai's avatar zhangwenshuai

修改search和select的下拉样式

parent d887e67d
...@@ -8,8 +8,15 @@ ...@@ -8,8 +8,15 @@
border-radius: 0; border-radius: 0;
display: flex; display: flex;
align-items: center; align-items: center;
height: auto;
} }
:global(.ant-select-selection__rendered) { :global(.ant-select-selection__rendered) {
width: 100%; width: 100%;
} }
} }
.searchDropdown {
overflow: auto;
:global(.ant-select-dropdown-menu) {
max-height: none;
}
}
...@@ -7,8 +7,16 @@ import { onBlurFn } from '../onBlurFn'; ...@@ -7,8 +7,16 @@ import { onBlurFn } from '../onBlurFn';
import s from './index.less'; import s from './index.less';
export const ApolloSearch = (props: ApolloSearchProps) => { export const ApolloSearch = (props: ApolloSearchProps) => {
const { onChange, maxCount, isMultiple, request } = props; const { onChange, maxCount, isMultiple, request, maxPopHeight } = props;
const selfProps = antiAssign(props, ['columnConfig', 'onChange', 'isMultiple', 'options', 'request', 'maxCount']); const selfProps = antiAssign(props, [
'columnConfig',
'onChange',
'isMultiple',
'options',
'request',
'maxCount',
'maxPopHeight',
]);
const isOpen: any = useRef(); const isOpen: any = useRef();
if (isMultiple) { if (isMultiple) {
selfProps.mode = 'multiple'; selfProps.mode = 'multiple';
...@@ -45,6 +53,10 @@ export const ApolloSearch = (props: ApolloSearchProps) => { ...@@ -45,6 +53,10 @@ export const ApolloSearch = (props: ApolloSearchProps) => {
onDropdownVisibleChange={selfProps.mode === 'multiple' ? multipleBlurFn : singleBlurFn} onDropdownVisibleChange={selfProps.mode === 'multiple' ? multipleBlurFn : singleBlurFn}
onChange={changeValue} onChange={changeValue}
initDataType="onfocus" initDataType="onfocus"
dropdownClassName={s.searchDropdown}
dropdownStyle={{
maxHeight: maxPopHeight,
}}
/> />
); );
}; };
...@@ -37,6 +37,7 @@ export const ApolloSelect = (props: ApolloSelectProps) => { ...@@ -37,6 +37,7 @@ export const ApolloSelect = (props: ApolloSelectProps) => {
{...selfProps} {...selfProps}
onChange={changeValue} onChange={changeValue}
onDropdownVisibleChange={selfProps.mode === 'multiple' ? multipleBlurFn : singleBlurFn} onDropdownVisibleChange={selfProps.mode === 'multiple' ? multipleBlurFn : singleBlurFn}
dropdownClassName={styles.selectDropdown}
dropdownStyle={{ dropdownStyle={{
maxHeight: maxPopHeight, maxHeight: maxPopHeight,
}} }}
......
...@@ -18,3 +18,9 @@ ...@@ -18,3 +18,9 @@
align-items: center; align-items: center;
} }
} }
.selectDropdown{
overflow: auto;
:global(.ant-select-dropdown-menu) {
max-height: none;
}
}
...@@ -227,7 +227,7 @@ class AssociationSearch extends React.Component<Props, State> { ...@@ -227,7 +227,7 @@ class AssociationSearch extends React.Component<Props, State> {
render() { render() {
const { data, value } = this.state; const { data, value } = this.state;
const { selfCom, autoFocus, onChange, maxPopHeight, ...rest } = this.props; const { selfCom, autoFocus, onChange, ...rest } = this.props;
return ( return (
<Consumer> <Consumer>
{({ locale }: any) => { {({ locale }: any) => {
...@@ -243,9 +243,6 @@ class AssociationSearch extends React.Component<Props, State> { ...@@ -243,9 +243,6 @@ class AssociationSearch extends React.Component<Props, State> {
onChange={this.handleChange} onChange={this.handleChange}
onFocus={this.onFocus} onFocus={this.onFocus}
onBlur={this.onBlur} onBlur={this.onBlur}
dropdownStyle={{
maxHeight: maxPopHeight,
}}
> >
{data.map((d: any) => { {data.map((d: any) => {
return ( return (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment