mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-05 05:28:37 +08:00
a03a4bbbde
* 新增移动端PopUp组件 * Update DatePicker.tsx Co-authored-by: zhangxulong <zhangxulong@baidu.com> Co-authored-by: 吴多益 <wuduoyi@baidu.com>
467 lines
9.1 KiB
SCSS
467 lines
9.1 KiB
SCSS
.#{$ns}DatePicker {
|
|
position: relative;
|
|
display: inline-flex;
|
|
flex-wrap: nowrap;
|
|
border: var(--DatePicker-borderWidth) solid var(--DatePicker-borderColor);
|
|
font-size: var(--DatePicker-fontSize);
|
|
padding: var(--DatePicker-paddingY) var(--DatePicker-paddingX);
|
|
height: var(--DatePicker-height);
|
|
outline: none;
|
|
white-space: nowrap;
|
|
color: var(--DatePicker-color);
|
|
background: var(--DatePicker-bg);
|
|
border-radius: var(--DatePicker-borderRadius);
|
|
|
|
@include input-border();
|
|
|
|
&:not(.is-disabled) {
|
|
cursor: pointer;
|
|
|
|
&:hover {
|
|
background: var(--DatePicker-onHover-bg);
|
|
border-color: var(--DatePicker-onHover-borderColor);
|
|
|
|
.#{$ns}DatePicker-toggler:before {
|
|
color: var(--DatePicker-onHover-iconColor);
|
|
}
|
|
}
|
|
}
|
|
|
|
&.is-focused {
|
|
border-color: var(--DatePicker-onFocused-borderColor);
|
|
box-shadow: var(--Form-input-boxShadow);
|
|
}
|
|
|
|
&.is-disabled {
|
|
background: $gray200;
|
|
|
|
> .#{$ns}DatePicker-input {
|
|
color: var(--text--muted-color);
|
|
}
|
|
}
|
|
|
|
&-placeholder {
|
|
color: var(--DatePicker-placeholderColor);
|
|
user-select: none;
|
|
margin-right: var(--gap-base);
|
|
min-width: px2rem(50px);
|
|
flex-basis: 0;
|
|
flex-grow: 1;
|
|
}
|
|
|
|
&-value {
|
|
margin-right: var(--gap-base);
|
|
flex-basis: 0;
|
|
flex-grow: 1;
|
|
}
|
|
|
|
&-toggler {
|
|
cursor: pointer;
|
|
color: var(--DatePicker-iconColor);
|
|
display: inline-flex;
|
|
align-items: center;
|
|
|
|
&:hover {
|
|
color: var(--DatePicker-onHover-iconColor);
|
|
}
|
|
}
|
|
|
|
&-clear {
|
|
display: inline-block;
|
|
@include input-clear();
|
|
line-height: 1;
|
|
margin-right: var(--gap-xs);
|
|
}
|
|
}
|
|
|
|
.#{$ns}DateControl:not(.is-inline) > .#{$ns}DatePicker {
|
|
display: flex;
|
|
}
|
|
|
|
.#{$ns}DatePicker-shortcuts {
|
|
margin: 0;
|
|
background: var(--Calendar-shortcuts-bg);
|
|
padding: calc(
|
|
(
|
|
var(--Calendar-shortcuts-height) - var(--Calendar-fontSize) *
|
|
var(--lineHeightBase)
|
|
) / 2
|
|
)
|
|
var(--gap-sm);
|
|
list-style: none;
|
|
width: px2rem(250px);
|
|
|
|
& + .rdt .rdtPicker {
|
|
padding-top: 0;
|
|
}
|
|
}
|
|
|
|
.#{$ns}DatePicker-shortcut {
|
|
display: inline-block;
|
|
margin-right: var(--gap-sm);
|
|
|
|
a {
|
|
font-size: var(--Calendar-fontSize);
|
|
cursor: pointer;
|
|
color: var(--Calendar-shortcut-color);
|
|
text-decoration: var(--Calendar-shortcut-decoration);
|
|
|
|
&:hover {
|
|
color: var(--Calendar-shortcut-onHover-color);
|
|
text-decoration: var(--Calendar-shortcut-onHover-decoration);
|
|
}
|
|
}
|
|
}
|
|
|
|
.#{$ns}DatePicker-popover {
|
|
margin: px2rem(2px) 0 0;
|
|
|
|
&.#{$ns}PopOver--leftTopLeftBottom,
|
|
&.#{$ns}PopOver--rightTopRightBottom {
|
|
margin: px2rem(-2px) 0 0;
|
|
}
|
|
}
|
|
|
|
.#{$ns}DatePicker-popup {
|
|
height: 80vh;
|
|
}
|
|
// override third-party styles
|
|
.rdt {
|
|
user-select: none;
|
|
font-size: var(--Calendar-fontSize);
|
|
color: var(--Calendar-color);
|
|
|
|
.rdtPicker {
|
|
margin-top: 0;
|
|
padding: var(--gap-sm);
|
|
background: transparent;
|
|
border: none;
|
|
|
|
.dow {
|
|
color: var(--Calendar-wLabel-color);
|
|
font-weight: normal;
|
|
}
|
|
|
|
td.rdtDay,
|
|
td.rdtHour,
|
|
td.rdtMinute,
|
|
td.rdtSecond,
|
|
.rdtTimeToggle {
|
|
background: var(--Calendar-cell-bg);
|
|
|
|
&:hover {
|
|
background: var(--Calendar-cell-onHover-bg);
|
|
}
|
|
}
|
|
|
|
td.rdtBetween {
|
|
background: var(--Calendar-cell-onBetween-bg);
|
|
}
|
|
|
|
td.rdtToday:before {
|
|
border-bottom-color: var(--Calendar-cell-onActive-bg);
|
|
}
|
|
|
|
td.rdtActive.rdtToday:before {
|
|
border-bottom-color: var(--Calendar-cell-bg);
|
|
}
|
|
|
|
td.rdtActive,
|
|
td.rdtActive:hover {
|
|
background: var(--Calendar-cell-onActive-bg);
|
|
}
|
|
|
|
td.rdtDisabled,
|
|
td.rdtDisabled:hover {
|
|
background: var(--Calendar-cell-onDisabled-bg);
|
|
}
|
|
}
|
|
|
|
thead tr:first-child th {
|
|
cursor: default;
|
|
font-weight: normal;
|
|
border-bottom: none;
|
|
}
|
|
|
|
thead tr:first-child th:hover {
|
|
background: transparent;
|
|
}
|
|
|
|
tfoot {
|
|
border-top: 0;
|
|
|
|
td {
|
|
padding-top: var(--gap-xs);
|
|
text-align: left;
|
|
|
|
span {
|
|
width: 10px;
|
|
display: inline-block;
|
|
text-align: center;
|
|
}
|
|
|
|
.rdtActions {
|
|
margin-top: var(--gap-sm);
|
|
text-align: right;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.#{$ns}CalendarInputWrapper {
|
|
display: inline-block;
|
|
position: relative;
|
|
.#{$ns}CalendarInput-sugs {
|
|
list-style: none;
|
|
position: absolute;
|
|
background: var(--Form-select-menu-bg);
|
|
color: var(--Form-select-menu-color);
|
|
border: var(--Form-input-borderWidth) solid
|
|
var(--Form-input-onFocused-borderColor);
|
|
left: px2rem(-1px);
|
|
right: px2rem(-1px);
|
|
top: 100%;
|
|
z-index: 10;
|
|
max-height: px2rem(200px);
|
|
overflow: auto;
|
|
&Item {
|
|
padding-left: 4px;
|
|
&.is-highlight,
|
|
&:hover {
|
|
color: var(--Form-select-menu-onHover-color);
|
|
background: var(--Form-select-menu-onHover-bg);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.#{$ns}CalendarInput {
|
|
outline: none;
|
|
width: 40px;
|
|
font-size: var(--Calendar-input-fontSize);
|
|
color: var(--Calendar-input-color);
|
|
border: 1px solid var(--Calendar-input-borderColor);
|
|
border-radius: var(--Calendar-input-borderRadius);
|
|
height: var(--Calendar-input-height);
|
|
line-height: var(--Calendar-input-lineHeight);
|
|
padding: var(--Calendar-input-paddingY) var(--Calendar-input-paddingX);
|
|
box-shadow: none;
|
|
|
|
&:focus {
|
|
border-color: var(--Calendar-input-onFocused-borderColor);
|
|
box-shadow: none;
|
|
}
|
|
}
|
|
|
|
.#{$ns}CalendarTime {
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
|
|
.#{$ns}CalendarCounter {
|
|
&-btn {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
height: 25px;
|
|
text-align: center;
|
|
color: var(--Button--primary-bg);
|
|
|
|
&:hover {
|
|
color: var(--Button--primary-onActive-bg);
|
|
}
|
|
|
|
> svg {
|
|
width: 16px;
|
|
height: 16px;
|
|
}
|
|
|
|
&--up > svg {
|
|
transform: rotate(-90deg);
|
|
}
|
|
|
|
&--down > svg {
|
|
transform: rotate(90deg);
|
|
}
|
|
}
|
|
|
|
&-sep {
|
|
width: var(--gap-md);
|
|
text-align: center;
|
|
}
|
|
|
|
&--daypart {
|
|
margin-left: 10px;
|
|
}
|
|
|
|
&--daypart &-value {
|
|
height: 30px;
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 0 5px;
|
|
}
|
|
}
|
|
|
|
.rdtBtn {
|
|
line-height: var(--Calendar-btn-lineHeight);
|
|
padding: var(--Calendar-btn-paddingY) var(--Calendar-btn-paddingX);
|
|
display: inline-block;
|
|
vertical-align: middle;
|
|
text-align: center;
|
|
user-select: none;
|
|
cursor: pointer;
|
|
text-decoration: none;
|
|
font-size: var(--Calendar-btn-fontSize);
|
|
border: 1px solid var(--Calendar-btn-border);
|
|
|
|
&:hover {
|
|
text-decoration: none;
|
|
}
|
|
|
|
&.is-disabled {
|
|
border-color: var(--Button-onDisabled-borderColor);
|
|
opacity: 0.6;
|
|
pointer-events: none;
|
|
}
|
|
|
|
.fa,
|
|
.iconfont {
|
|
font-size: var(--fontSizeSm);
|
|
}
|
|
|
|
@include button-variant(
|
|
var(--Calendar-btn-bg),
|
|
var(--Calendar-btn-border),
|
|
var(--Calendar-btn-color),
|
|
var(--Calendar-btn-onHover-bg),
|
|
var(--Calendar-btn-onHover-border),
|
|
var(--Calendar-btn-onHover-color),
|
|
var(--Calendar-btn-onActive-bg),
|
|
var(--Calendar-btn-onActive-border),
|
|
var(--Calendar-btn-onActive-color)
|
|
);
|
|
|
|
border-radius: var(--Calendar-btn-borderRadius);
|
|
|
|
& + .rdtBtn {
|
|
margin-left: var(--gap-xs);
|
|
}
|
|
|
|
&Cancel {
|
|
@include button-variant(
|
|
var(--Calendar-btnCancel-bg),
|
|
var(--Calendar-btnCancel-border),
|
|
var(--Calendar-btnCancel-color),
|
|
var(--Calendar-btnCancel-onHover-bg),
|
|
var(--Calendar-btnCancel-onHover-border),
|
|
var(--Calendar-btnCancel-onHover-color),
|
|
var(--Calendar-btnCancel-onActive-bg),
|
|
var(--Calendar-btnCancel-onActive-border),
|
|
var(--Calendar-btnCancel-onActive-color)
|
|
);
|
|
}
|
|
}
|
|
|
|
.rdtBtnPrev:before,
|
|
.rdtBtnNext:before {
|
|
display: inline-block;
|
|
color: inherit;
|
|
font-style: normal;
|
|
line-height: 1;
|
|
}
|
|
|
|
.rdtPrev,
|
|
.rdtNext {
|
|
cursor: pointer !important;
|
|
width: var(--gap-md);
|
|
padding: 0;
|
|
color: #999;
|
|
font-size: var(--fontSizeXl);
|
|
text-decoration: none;
|
|
font-family: auto;
|
|
font-weight: normal;
|
|
|
|
&:hover {
|
|
text-decoration: none;
|
|
color: #000;
|
|
}
|
|
}
|
|
|
|
.rdtSwitch {
|
|
text-align: center;
|
|
color: #000;
|
|
cursor: pointer;
|
|
font-weight: normal;
|
|
|
|
&:hover {
|
|
color: var(--link-onHover-color);
|
|
text-decoration: none;
|
|
}
|
|
}
|
|
|
|
.rdtHeader {
|
|
display: table;
|
|
table-layout: fixed;
|
|
border-collapse: separate;
|
|
width: 100%;
|
|
// padding: 0 10px;
|
|
|
|
> * {
|
|
display: table-cell;
|
|
vertical-align: middle;
|
|
text-align: center;
|
|
}
|
|
|
|
.rdtSwitch + .rdtSwitch {
|
|
margin-left: var(--gap-xs);
|
|
}
|
|
}
|
|
|
|
td.rdtMonth,
|
|
td.rdtYear,
|
|
td.rdtQuarter {
|
|
width: px2rem(50px);
|
|
height: px2rem(40px);
|
|
|
|
> span {
|
|
height: px2rem(24px);
|
|
display: block;
|
|
}
|
|
|
|
&.rdtBetween {
|
|
background: transparent !important;
|
|
|
|
> span {
|
|
background: var(--Calendar-cell-onBetween-bg);
|
|
}
|
|
}
|
|
|
|
&:hover,
|
|
&.rdtActive {
|
|
background: transparent !important;
|
|
|
|
> span {
|
|
background: var(--info);
|
|
color: var(--white);
|
|
}
|
|
}
|
|
|
|
&.rdtDisabled {
|
|
background: transparent !important;
|
|
|
|
> span {
|
|
background: #edf1f2;
|
|
color: #999;
|
|
}
|
|
}
|
|
}
|
|
|
|
.#{$ns}DateCalendar {
|
|
display: inline-block;
|
|
border: var(--DatePicker-borderWidth) solid var(--DatePicker-borderColor);
|
|
background: var(--DatePicker-bg);
|
|
border-radius: var(--DatePicker-borderRadius);
|
|
}
|