mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-01 03:29:39 +08:00
fix: set min-width instead of width (#15547)
* fix: set min-width instead of width * test: updte snapshots
This commit is contained in:
parent
c8a326643d
commit
4eb33eb149
@ -348,7 +348,7 @@ exports[`renders ./components/date-picker/demo/disabled-date.md correctly 1`] =
|
||||
<div>
|
||||
<span
|
||||
class="ant-calendar-picker"
|
||||
style="width:195px"
|
||||
style="min-width:195px"
|
||||
>
|
||||
<div>
|
||||
<input
|
||||
@ -493,7 +493,7 @@ exports[`renders ./components/date-picker/demo/extra-footer.md correctly 1`] = `
|
||||
</span>
|
||||
<span
|
||||
class="ant-calendar-picker"
|
||||
style="width:195px"
|
||||
style="min-width:195px"
|
||||
>
|
||||
<div>
|
||||
<input
|
||||
@ -872,7 +872,7 @@ exports[`renders ./components/date-picker/demo/mode.md correctly 1`] = `
|
||||
<div>
|
||||
<span
|
||||
class="ant-calendar-picker"
|
||||
style="width:195px"
|
||||
style="min-width:195px"
|
||||
>
|
||||
<div>
|
||||
<input
|
||||
@ -1264,7 +1264,7 @@ exports[`renders ./components/date-picker/demo/start-end.md correctly 1`] = `
|
||||
<div>
|
||||
<span
|
||||
class="ant-calendar-picker"
|
||||
style="width:195px"
|
||||
style="min-width:195px"
|
||||
>
|
||||
<div>
|
||||
<input
|
||||
@ -1295,7 +1295,7 @@ exports[`renders ./components/date-picker/demo/start-end.md correctly 1`] = `
|
||||
</span>
|
||||
<span
|
||||
class="ant-calendar-picker"
|
||||
style="width:195px"
|
||||
style="min-width:195px"
|
||||
>
|
||||
<div>
|
||||
<input
|
||||
@ -1567,7 +1567,7 @@ exports[`renders ./components/date-picker/demo/time.md correctly 1`] = `
|
||||
<div>
|
||||
<span
|
||||
class="ant-calendar-picker"
|
||||
style="width:195px"
|
||||
style="min-width:195px"
|
||||
>
|
||||
<div>
|
||||
<input
|
||||
|
@ -1029,7 +1029,7 @@ exports[`Picker format by locale date 1`] = `
|
||||
exports[`Picker format by locale dateTime 1`] = `
|
||||
<span
|
||||
class="ant-calendar-picker"
|
||||
style="width: 195px;"
|
||||
style="min-width: 195px;"
|
||||
>
|
||||
<div>
|
||||
<input
|
||||
|
@ -34,7 +34,7 @@ export default function createPicker(TheCalendar: React.ComponentClass): any {
|
||||
|
||||
static getDerivedStateFromProps(nextProps: PickerProps, prevState: PickerState) {
|
||||
const state: Partial<PickerState> = {};
|
||||
let open: boolean = prevState.open;
|
||||
let { open } = prevState;
|
||||
|
||||
if ('open' in nextProps) {
|
||||
state.open = nextProps.open;
|
||||
@ -53,6 +53,7 @@ export default function createPicker(TheCalendar: React.ComponentClass): any {
|
||||
}
|
||||
|
||||
private input: any;
|
||||
|
||||
private prefixCls?: string;
|
||||
|
||||
constructor(props: any) {
|
||||
@ -92,7 +93,7 @@ export default function createPicker(TheCalendar: React.ComponentClass): any {
|
||||
};
|
||||
|
||||
handleChange = (value: moment.Moment | null) => {
|
||||
const props = this.props;
|
||||
const { props } = this;
|
||||
if (!('value' in props)) {
|
||||
this.setState({
|
||||
value,
|
||||
@ -155,13 +156,13 @@ export default function createPicker(TheCalendar: React.ComponentClass): any {
|
||||
|
||||
let pickerProps: Object = {};
|
||||
let calendarProps: any = {};
|
||||
const pickerStyle: { width?: number } = {};
|
||||
const pickerStyle: { minWidth?: number } = {};
|
||||
if (props.showTime) {
|
||||
calendarProps = {
|
||||
// fix https://github.com/ant-design/ant-design/issues/1902
|
||||
onSelect: this.handleChange,
|
||||
};
|
||||
pickerStyle.width = 195;
|
||||
pickerStyle.minWidth = 195;
|
||||
} else {
|
||||
pickerProps = {
|
||||
onChange: this.handleChange,
|
||||
|
@ -2550,7 +2550,7 @@ exports[`renders ./components/form/demo/time-related-controls.md correctly 1`] =
|
||||
<span
|
||||
class="ant-calendar-picker"
|
||||
id="time_related_controls_date-time-picker"
|
||||
style="width:195px"
|
||||
style="min-width:195px"
|
||||
>
|
||||
<div>
|
||||
<input
|
||||
|
Loading…
Reference in New Issue
Block a user