日期时间范围,下拉增加popoverClassName属性,可以自定义弹框的className;父级有缩放比时弹框宽度计算问题修复; (#1954)

* 日期时间范围,下拉增加popoverClassName属性,可以自定义弹框的className;父级有缩放比时弹框宽度计算问题修复;

* 日期时间范围,下拉增加popoverClassName属性,可以自定义弹框的className;父级有缩放比时弹框宽度计算问题修复;

Co-authored-by: limengzhao <limengzhao@baidu.com>
This commit is contained in:
北风慕蝶 2021-05-13 10:02:37 +08:00 committed by GitHub
parent facf045086
commit ac2c105f60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 25 additions and 16 deletions

View File

@ -21,6 +21,7 @@ export interface ColorProps extends LocaleProps, ThemeProps {
// closeOnSelect:boolean; // closeOnSelect:boolean;
clearable: boolean; clearable: boolean;
className?: string; className?: string;
popoverClassName?: string;
disabled?: boolean; disabled?: boolean;
popOverContainer?: any; popOverContainer?: any;
placement?: string; placement?: string;
@ -205,6 +206,7 @@ export class ColorControl extends React.PureComponent<
const { const {
classPrefix: ns, classPrefix: ns,
className, className,
popoverClassName,
value, value,
placeholder, placeholder,
disabled, disabled,
@ -272,7 +274,7 @@ export class ColorControl extends React.PureComponent<
> >
<PopOver <PopOver
classPrefix={ns} classPrefix={ns}
className={cx('ColorPicker-popover')} className={cx('ColorPicker-popover', popoverClassName)}
onHide={this.close} onHide={this.close}
overlay overlay
> >

View File

@ -236,6 +236,7 @@ export type ShortCuts =
export interface DateProps extends LocaleProps, ThemeProps { export interface DateProps extends LocaleProps, ThemeProps {
viewMode: 'years' | 'months' | 'days' | 'time' | 'quarters'; viewMode: 'years' | 'months' | 'days' | 'time' | 'quarters';
className?: string; className?: string;
popoverClassName?: string;
placeholder?: string; placeholder?: string;
inputFormat?: string; inputFormat?: string;
timeFormat?: string; timeFormat?: string;
@ -523,6 +524,7 @@ export class DatePicker extends React.Component<DateProps, DatePickerState> {
classPrefix: ns, classPrefix: ns,
classnames: cx, classnames: cx,
className, className,
popoverClassName,
value, value,
placeholder, placeholder,
disabled, disabled,
@ -621,7 +623,7 @@ export class DatePicker extends React.Component<DateProps, DatePickerState> {
> >
<PopOver <PopOver
classPrefix={ns} classPrefix={ns}
className={cx(`DatePicker-popover`)} className={cx(`DatePicker-popover`, popoverClassName)}
onHide={this.close} onHide={this.close}
overlay overlay
onClick={this.handlePopOverClick} onClick={this.handlePopOverClick}

View File

@ -20,6 +20,7 @@ import {LocaleProps, localeable} from '../locale';
export interface DateRangePickerProps extends ThemeProps, LocaleProps { export interface DateRangePickerProps extends ThemeProps, LocaleProps {
className?: string; className?: string;
popoverClassName?: string;
placeholder?: string; placeholder?: string;
theme?: any; theme?: any;
format: string; format: string;
@ -677,6 +678,7 @@ export class DateRangePicker extends React.Component<
render() { render() {
const { const {
className, className,
popoverClassName,
classPrefix: ns, classPrefix: ns,
value, value,
placeholder, placeholder,
@ -774,7 +776,7 @@ export class DateRangePicker extends React.Component<
> >
<PopOver <PopOver
classPrefix={ns} classPrefix={ns}
className={`${ns}DateRangePicker-popover`} className={cx(`${ns}DateRangePicker-popover`, popoverClassName)}
onHide={this.close} onHide={this.close}
onClick={this.handlePopOverClick} onClick={this.handlePopOverClick}
overlay overlay

View File

@ -22,6 +22,7 @@ export interface LocationProps extends ThemeProps, LocaleProps {
}; };
disabled?: boolean; disabled?: boolean;
className?: string; className?: string;
popoverClassName?: string;
onChange: (value: any) => void; onChange: (value: any) => void;
popOverContainer?: any; popOverContainer?: any;
} }
@ -130,6 +131,7 @@ export class LocationPicker extends React.Component<
classnames: cx, classnames: cx,
value, value,
className, className,
popoverClassName,
disabled, disabled,
placeholder, placeholder,
clearable, clearable,
@ -184,7 +186,7 @@ export class LocationPicker extends React.Component<
show={isOpened} show={isOpened}
> >
<PopOver <PopOver
className={cx('LocationPicker-popover')} className={cx('LocationPicker-popover', popoverClassName)}
onHide={this.close} onHide={this.close}
overlay overlay
onClick={this.handlePopOverClick} onClick={this.handlePopOverClick}

View File

@ -21,6 +21,7 @@ import capitalize from 'lodash/capitalize';
export interface MonthRangePickerProps extends ThemeProps, LocaleProps { export interface MonthRangePickerProps extends ThemeProps, LocaleProps {
className?: string; className?: string;
popoverClassName?: string;
placeholder?: string; placeholder?: string;
theme?: any; theme?: any;
format: string; format: string;
@ -437,6 +438,7 @@ export class MonthRangePicker extends React.Component<
render() { render() {
const { const {
className, className,
popoverClassName,
classPrefix: ns, classPrefix: ns,
value, value,
placeholder, placeholder,
@ -534,7 +536,7 @@ export class MonthRangePicker extends React.Component<
> >
<PopOver <PopOver
classPrefix={ns} classPrefix={ns}
className={`${ns}DateRangePicker-popover`} className={cx(`${ns}DateRangePicker-popover`, popoverClassName)}
onHide={this.close} onHide={this.close}
onClick={this.handlePopOverClick} onClick={this.handlePopOverClick}
overlay overlay

View File

@ -84,7 +84,7 @@ export class PopOverContainer extends React.Component<
className={popOverClassName} className={popOverClassName}
style={{ style={{
minWidth: this.target minWidth: this.target
? Math.max(this.target.getBoundingClientRect().width, 100) ? Math.max(this.target.offsetWidth().width, 100)
: 'auto' : 'auto'
}} }}
onHide={this.close} onHide={this.close}

View File

@ -247,6 +247,7 @@ const DownshiftChangeTypes = Downshift.stateChangeTypes;
interface SelectProps extends OptionProps, ThemeProps, LocaleProps { interface SelectProps extends OptionProps, ThemeProps, LocaleProps {
className?: string; className?: string;
popoverClassName?: string;
creatable: boolean; creatable: boolean;
createBtnLabel: string; createBtnLabel: string;
multiple: boolean; multiple: boolean;
@ -710,6 +711,7 @@ export class Select extends React.Component<SelectProps, SelectState> {
creatable, creatable,
multiple, multiple,
classnames: cx, classnames: cx,
popoverClassName,
checkAll, checkAll,
checkAllLabel, checkAllLabel,
searchable, searchable,
@ -809,8 +811,8 @@ export class Select extends React.Component<SelectProps, SelectState> {
index index
})} })}
</Checkbox> </Checkbox>
) ) : (
: renderMenu(item, { renderMenu(item, {
multiple, multiple,
checkAll, checkAll,
checked, checked,
@ -819,6 +821,7 @@ export class Select extends React.Component<SelectProps, SelectState> {
searchable, searchable,
index index
}) })
)
) : checkAll || multiple ? ( ) : checkAll || multiple ? (
<Checkbox <Checkbox
checked={checked} checked={checked}
@ -942,11 +945,9 @@ export class Select extends React.Component<SelectProps, SelectState> {
> >
<PopOver <PopOver
overlay overlay
className={cx('Select-popover')} className={cx('Select-popover', popoverClassName)}
style={{ style={{
minWidth: this.target minWidth: this.target ? this.target.offsetWidth : 'auto'
? this.target.getBoundingClientRect().width
: 'auto'
}} }}
onHide={this.close} onHide={this.close}
> >

View File

@ -216,7 +216,7 @@ export default class DropDownButton extends React.Component<
onHide={this.close} onHide={this.close}
classPrefix={ns} classPrefix={ns}
className={cx('DropDown-popover')} className={cx('DropDown-popover')}
style={{minWidth: this.target?.getBoundingClientRect().width}} style={{minWidth: this.target?.offsetWidth}}
> >
{body} {body}
</PopOver> </PopOver>

View File

@ -466,9 +466,7 @@ export default class TreeSelectControl extends React.Component<
classPrefix={ns} classPrefix={ns}
className={`${ns}TreeSelect-popover`} className={`${ns}TreeSelect-popover`}
style={{ style={{
minWidth: this.target minWidth: this.target ? this.target.offsetWidth : undefined
? this.target.getBoundingClientRect().width
: undefined
}} }}
onHide={this.close} onHide={this.close}
overlay overlay