Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix member selector dropdown width error #2932

Merged
merged 1 commit into from Feb 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions shell/app/common/components/load-more-selector/index.tsx
Expand Up @@ -19,6 +19,7 @@ import { map, isEmpty, isNumber, filter, find, isArray, get, isEqual } from 'lod
import { useEffectOnce, useDebounce, useDeepCompareEffect } from 'react-use';
import { Icon as CustomIcon, ErdaIcon } from 'common';
import { useUpdate } from 'common/use-hooks';
import { uuid } from 'common/utils';
import { isPromise } from 'common/utils';
import i18n from 'i18n';

Expand Down Expand Up @@ -165,6 +166,7 @@ const PureLoadMoreSelector = (props: IProps) => {
const [contentWidth, setContentWidth] = React.useState('');
const [innerValue, setInnerValue] = React.useState([value] as any[]);
const [valueChanged, setValueChanged] = React.useState(false);
const [compId, setCompId] = React.useState(uuid());
const reqRef = React.useRef(null as any);

const searchRef = React.useRef(null);
Expand Down Expand Up @@ -197,7 +199,7 @@ const PureLoadMoreSelector = (props: IProps) => {
}, [visible, searchRefCur]);

// 带上select的dropdownMatchSelectWidth特性
const dropdownMinWidth = get(document.querySelector('.load-more-selector-dropdown'), 'style.minWidth');
const dropdownMinWidth = get(document.querySelector(`.load-more-selector-dropdown-${compId}`), 'style.minWidth');
React.useEffect(() => {
if (dropdownMatchSelectWidth && dropdownMinWidth) {
setContentWidth(dropdownMinWidth);
Expand Down Expand Up @@ -389,7 +391,7 @@ const PureLoadMoreSelector = (props: IProps) => {
<Dropdown
overlay={getOverlay()}
visible={visible}
overlayClassName={`load-more-selector-dropdown ${dropdownClassName}`}
overlayClassName={`load-more-selector-dropdown load-more-selector-dropdown-${compId} ${dropdownClassName}`}
overlayStyle={dropdownStyle}
onVisibleChange={(visible) => onVisibleChange?.(visible, innerValue)}
>
Expand Down