fix: datetime-range修复picker改动 (#3314)

Co-authored-by: hongyang03 <hongyang03@baidu.com>
This commit is contained in:
HongYang 2021-12-30 20:22:13 +08:00 committed by GitHub
parent 1c21a0c977
commit 1aa45a631f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 7 deletions

View File

@ -245,7 +245,7 @@
background: #fff;
box-shadow: 0 0 2px 2px rgba(0,0,0,0.02);
border-radius: 24px;
overflow-x: scroll;
overflow-x: auto;
position: relative;
height: px2rem(48px);
line-height: px2rem(48px);
@ -345,7 +345,7 @@
}
&-time {
height: px2rem(200px);
height: px2rem(180px);
&-title {
border: var(--Calendar-borderWidth) solid var(--borderColorDarken);
border-left: none;
@ -358,4 +358,11 @@
margin: 0 auto;
}
}
.#{$ns}CalendarTime {
height: px2rem(130px);
overflow: hidden;
}
.#{$ns}PickerColumns-header {
display: none;
}
}

View File

@ -252,8 +252,8 @@ export class CalendarMobile extends React.Component<
if (startDate) {
let obj = {
dateTime: newTime,
startDate: endDate ? startDate : startDate?.clone().set({hour: newTime[0], minute: newTime[1], second: 0}),
endDate: !endDate ? endDate : endDate?.clone().set({hour: newTime[0], minute: newTime[1], second: 0})
startDate: endDate ? startDate : startDate?.clone().set({hour: newTime[0], minute: newTime[1], second: newTime[2] || 0}),
endDate: !endDate ? endDate : endDate?.clone().set({hour: newTime[0], minute: newTime[1], second: newTime[2] || 0})
};
this.setState(obj, () => {
onChange && onChange(this.state);
@ -361,7 +361,7 @@ export class CalendarMobile extends React.Component<
) {
return this.setState(
{
endDate: newValue.clone().endOf(precision).set({hour: dateTime[0], minute: dateTime[1], second: 0})
endDate: newValue.clone().endOf(precision).set({hour: dateTime[0], minute: dateTime[1], second: dateTime[2] || 0})
},
() => {
onChange && onChange(this.state, () => embed && confirm && confirm());
@ -371,7 +371,7 @@ export class CalendarMobile extends React.Component<
this.setState(
{
startDate: newValue.clone().startOf(precision).set({hour: dateTime[0], minute: dateTime[1], second: 0}),
startDate: newValue.clone().startOf(precision).set({hour: dateTime[0], minute: dateTime[1], second: dateTime[2] || 0}),
endDate: undefined
},
() => {
@ -477,7 +477,7 @@ export class CalendarMobile extends React.Component<
locale={locale}
useMobileUI={true}
showToolbar={false}
viewDate={moment().set({hour: dateTime[0], minute: dateTime[1], second: 0})}
viewDate={moment().set({hour: dateTime[0], minute: dateTime[1], second: dateTime[2] || 0})}
/>
</div>
);

View File

@ -214,6 +214,7 @@ export class CustomTimeView extends TimeView {
this.setState((prevState: State) => {
return {...prevState, ...time}
});
this.props.onChange && this.props.onChange(value);
}
renderTimeViewPicker = () => {