chore: datepicker 移动端样式优化 (#3325)

* fix: 修复 crud 中放 form 里面的 combo 填充不正确的问题 (#3251)

* 发布新版本

* fix: 修复 crud 中放 form 里面的 combo 填充不正确的问题

* bugfix:button样式,移动端embed不展示picker选择,兼容移动端选择框样式

Co-authored-by: liaoxuezhi <liaoxuezhi@baidu.com>
This commit is contained in:
ucasliyuan 2021-12-31 16:28:45 +08:00 committed by GitHub
parent a106f65869
commit 00b0e445c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 7 deletions

View File

@ -22,7 +22,7 @@
height: 100%;
padding: var(--PickerColumns-action-padding);
font-size: var(--PickerColumns-action-fontSize);
background-color: none !important;
background-color: transparent !important;
border: none;
cursor: pointer;
@ -35,11 +35,11 @@
}
&-confirm {
color: var(--PickerColumns-confirmAction-color);
color: var(--PickerColumns-confirmAction-color) !important;
}
&-cancel {
color: var(--PickerColumns-cancelAction-color);
color: var(--PickerColumns-cancelAction-color) !important;
}
&-title {

View File

@ -126,6 +126,39 @@
height: px2rem(300px);
}
// 移动端输入框样式
.#{$ns}DatePicker.is-mobile {
border: 0;
justify-content: flex-end;
span,
a {
&:focus {
outline: unset;
}
}
.#{$ns}DatePicker-value,
.#{$ns}DatePicker-clear {
display: inline-flex;
justify-content: flex-end;
padding: 0 0;
}
.#{$ns}DatePicker-value {
margin-right: var(--gap-xs);
}
.#{$ns}DatePicker-placeholder {
flex-grow: unset;
flex-basis: unset;
}
.#{$ns}DatePicker-toggler {
margin-top: -3px;
}
}
.#{$ns}DatePicker-popup.#{$ns}DatePicker-mobile {
color: red;
.rdt {

View File

@ -288,8 +288,9 @@ export interface DateProps extends LocaleProps, ThemeProps {
scheduleClassNames?: Array<string>;
largeMode?: boolean;
onScheduleClick?: (scheduleData: any) => void;
useMobileUI?: boolean;
// 在移动端日期展示有多种形式一种是picker 滑动选择一种是日历展开选择mobileCalendarMode为calendar表示日历展开选择
mobileCalendarMode?: 'picker' | 'calendar';
// 下面那个千万不要写,写了就会导致 keyof DateProps 得到的结果是 string | number;
// [propName: string]: any;
@ -571,7 +572,8 @@ export class DatePicker extends React.Component<DateProps, DatePickerState> {
schedules,
largeMode,
scheduleClassNames,
onScheduleClick
onScheduleClick,
mobileCalendarMode
} = this.props;
const __ = this.props.translate;
@ -628,6 +630,7 @@ export class DatePicker extends React.Component<DateProps, DatePickerState> {
schedules={schedulesData}
largeMode={largeMode}
onScheduleClick={onScheduleClick}
embed={embed}
useMobileUI={useMobileUI}
/>
</div>
@ -645,7 +648,8 @@ export class DatePicker extends React.Component<DateProps, DatePickerState> {
{
'is-disabled': disabled,
'is-focused': this.state.isFocused,
[`DatePicker--border${ucFirst(borderMode)}`]: borderMode
[`DatePicker--border${ucFirst(borderMode)}`]: borderMode,
'is-mobile': useMobileUI && isMobile()
},
className
)}
@ -718,7 +722,7 @@ export class DatePicker extends React.Component<DateProps, DatePickerState> {
showClose={false}
onHide={this.handleClick}
>
{this.renderShortCuts(shortcuts)}
{mobileCalendarMode === 'calendar' && this.renderShortCuts(shortcuts)}
<Calendar
value={date}

View File

@ -57,6 +57,7 @@ interface BaseDatePickerProps
hideHeader?: boolean;
updateOn?: string;
useMobileUI?: boolean;
embed?: boolean;
showToolbar?: boolean;
}