From a2cecbaf9614bac05f314adc537a0694cd6aa410 Mon Sep 17 00:00:00 2001 From: zhangwenshuai Date: Wed, 29 Jul 2020 22:17:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9search=E5=92=8Cselect?= =?UTF-8?q?=E7=9A=84=E4=B8=8B=E6=8B=89=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/base/edit/search/index.less | 7 +++++++ .../component/base/edit/search/index.tsx | 16 ++++++++++++++-- .../component/base/edit/select/index.tsx | 1 + .../component/base/edit/select/styles.less | 6 ++++++ .../base/extra/associationSearch/index.tsx | 5 +---- 5 files changed, 29 insertions(+), 6 deletions(-) diff --git a/components/apolloTable/component/base/edit/search/index.less b/components/apolloTable/component/base/edit/search/index.less index 0b0908b..a536dd8 100644 --- a/components/apolloTable/component/base/edit/search/index.less +++ b/components/apolloTable/component/base/edit/search/index.less @@ -8,8 +8,15 @@ border-radius: 0; display: flex; align-items: center; + height: auto; } :global(.ant-select-selection__rendered) { width: 100%; } } +.searchDropdown { + overflow: auto; + :global(.ant-select-dropdown-menu) { + max-height: none; + } +} diff --git a/components/apolloTable/component/base/edit/search/index.tsx b/components/apolloTable/component/base/edit/search/index.tsx index e454a32..fe04005 100644 --- a/components/apolloTable/component/base/edit/search/index.tsx +++ b/components/apolloTable/component/base/edit/search/index.tsx @@ -7,8 +7,16 @@ import { onBlurFn } from '../onBlurFn'; import s from './index.less'; export const ApolloSearch = (props: ApolloSearchProps) => { - const { onChange, maxCount, isMultiple, request } = props; - const selfProps = antiAssign(props, ['columnConfig', 'onChange', 'isMultiple', 'options', 'request', 'maxCount']); + const { onChange, maxCount, isMultiple, request, maxPopHeight } = props; + const selfProps = antiAssign(props, [ + 'columnConfig', + 'onChange', + 'isMultiple', + 'options', + 'request', + 'maxCount', + 'maxPopHeight', + ]); const isOpen: any = useRef(); if (isMultiple) { selfProps.mode = 'multiple'; @@ -45,6 +53,10 @@ export const ApolloSearch = (props: ApolloSearchProps) => { onDropdownVisibleChange={selfProps.mode === 'multiple' ? multipleBlurFn : singleBlurFn} onChange={changeValue} initDataType="onfocus" + dropdownClassName={s.searchDropdown} + dropdownStyle={{ + maxHeight: maxPopHeight, + }} /> ); }; diff --git a/components/apolloTable/component/base/edit/select/index.tsx b/components/apolloTable/component/base/edit/select/index.tsx index 328a9e8..03c8c7f 100644 --- a/components/apolloTable/component/base/edit/select/index.tsx +++ b/components/apolloTable/component/base/edit/select/index.tsx @@ -37,6 +37,7 @@ export const ApolloSelect = (props: ApolloSelectProps) => { {...selfProps} onChange={changeValue} onDropdownVisibleChange={selfProps.mode === 'multiple' ? multipleBlurFn : singleBlurFn} + dropdownClassName={styles.selectDropdown} dropdownStyle={{ maxHeight: maxPopHeight, }} diff --git a/components/apolloTable/component/base/edit/select/styles.less b/components/apolloTable/component/base/edit/select/styles.less index ed123d1..d097d80 100644 --- a/components/apolloTable/component/base/edit/select/styles.less +++ b/components/apolloTable/component/base/edit/select/styles.less @@ -18,3 +18,9 @@ align-items: center; } } +.selectDropdown{ + overflow: auto; + :global(.ant-select-dropdown-menu) { + max-height: none; + } +} diff --git a/components/apolloTable/component/base/extra/associationSearch/index.tsx b/components/apolloTable/component/base/extra/associationSearch/index.tsx index aec8317..d32d190 100644 --- a/components/apolloTable/component/base/extra/associationSearch/index.tsx +++ b/components/apolloTable/component/base/extra/associationSearch/index.tsx @@ -227,7 +227,7 @@ class AssociationSearch extends React.Component { render() { const { data, value } = this.state; - const { selfCom, autoFocus, onChange, maxPopHeight, ...rest } = this.props; + const { selfCom, autoFocus, onChange, ...rest } = this.props; return ( {({ locale }: any) => { @@ -243,9 +243,6 @@ class AssociationSearch extends React.Component { onChange={this.handleChange} onFocus={this.onFocus} onBlur={this.onBlur} - dropdownStyle={{ - maxHeight: maxPopHeight, - }} > {data.map((d: any) => { return ( -- 2.21.0