198 lines
4.5 KiB
CSS
198 lines
4.5 KiB
CSS
.date-range-picker {
|
|
width: 100%;
|
|
}
|
|
|
|
.date-range-fields {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
}
|
|
|
|
.date-field {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 4px;
|
|
}
|
|
|
|
.date-label {
|
|
font-size: 12px;
|
|
color: #666;
|
|
}
|
|
|
|
/* 隐藏原生日期选择器的外观 */
|
|
.date-input-wrapper {
|
|
position: relative;
|
|
width: 100%;
|
|
z-index: 1;
|
|
}
|
|
|
|
/* 输入框聚焦时的样式 */
|
|
.date-input-wrapper.focused .date-display {
|
|
border-color: var(--primary-color);
|
|
box-shadow: 0 0 0 2px rgba(0,104,74, 0.2);
|
|
}
|
|
|
|
/*
|
|
修改日期输入的位置和大小,使其覆盖整个显示区域,
|
|
提高z-index确保它能接收点击事件
|
|
*/
|
|
.date-input {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
opacity: 0;
|
|
cursor: pointer;
|
|
z-index: 2; /* 提高z-index以确保接收点击事件 */
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
/* 自定义显示样式 */
|
|
.date-display {
|
|
padding: 6px 12px;
|
|
border: 1px solid #e0e0e0;
|
|
border-radius: 4px;
|
|
font-size: 14px;
|
|
color: #333;
|
|
background-color: #fff;
|
|
width: 100%;
|
|
min-height: 36px;
|
|
display: flex;
|
|
align-items: center;
|
|
transition: all 0.2s ease;
|
|
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
|
|
background-repeat: no-repeat;
|
|
background-position: right 8px center;
|
|
background-size: 16px;
|
|
padding-right: 32px;
|
|
cursor: pointer;
|
|
outline: none;
|
|
-webkit-user-select: none;
|
|
-moz-user-select: none;
|
|
-ms-user-select: none;
|
|
user-select: none;
|
|
position: relative;
|
|
z-index: 1;
|
|
}
|
|
|
|
/* 占位符样式 */
|
|
.date-display.placeholder {
|
|
color: #999;
|
|
}
|
|
|
|
/* 悬停状态 */
|
|
.date-display:hover {
|
|
border-color: #c0c0c0;
|
|
background-color: #fafafa;
|
|
}
|
|
|
|
/* 焦点/键盘聚焦状态 */
|
|
.date-display:focus {
|
|
border-color: var(--primary-color);
|
|
box-shadow: 0 0 0 2px rgba(0,104,74, 0.2);
|
|
}
|
|
|
|
.date-input:focus + .date-display {
|
|
border-color: var(--primary-color);
|
|
box-shadow: 0 0 0 2px rgba(0,104,74, 0.2);
|
|
}
|
|
|
|
.date-separator {
|
|
margin: 0 4px;
|
|
color: #999;
|
|
font-size: 14px;
|
|
align-self: center;
|
|
padding-bottom: 0;
|
|
}
|
|
|
|
.simple-date-range-picker .date-range-fields {
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
.simple-date-range-picker .date-input-wrapper {
|
|
min-width: 130px;
|
|
max-width: 150px;
|
|
}
|
|
|
|
/* 增强按钮式外观 */
|
|
.date-display:active {
|
|
background-color: #f5f5f5;
|
|
border-color: #a0a0a0;
|
|
}
|
|
|
|
/* 响应式调整 */
|
|
@media (max-width: 640px) {
|
|
.date-range-fields {
|
|
flex-direction: column;
|
|
align-items: flex-start;
|
|
gap: 12px;
|
|
}
|
|
|
|
.date-separator {
|
|
display: none;
|
|
}
|
|
|
|
.simple-date-range-picker .date-range-fields {
|
|
flex-direction: row;
|
|
}
|
|
|
|
.simple-date-range-picker .date-separator {
|
|
display: block;
|
|
}
|
|
}
|
|
|
|
/* 深色模式支持 */
|
|
@media (prefers-color-scheme: dark) {
|
|
.date-label {
|
|
color: #b0b0b0;
|
|
}
|
|
|
|
.date-display {
|
|
background-color: #1f1f1f;
|
|
border-color: #444;
|
|
color: #e0e0e0;
|
|
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23aaa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
|
|
}
|
|
|
|
/* 深色模式占位符 */
|
|
.date-display.placeholder {
|
|
color: #777;
|
|
}
|
|
|
|
/* 深色模式悬停状态 */
|
|
.date-display:hover {
|
|
border-color: #555;
|
|
background-color: #2a2a2a;
|
|
}
|
|
|
|
/* 深色模式聚焦的输入容器 */
|
|
.date-input-wrapper.focused .date-display {
|
|
border-color: #177ddc;
|
|
box-shadow: 0 0 0 2px rgba(23, 125, 220, 0.2);
|
|
}
|
|
|
|
.date-input:focus + .date-display {
|
|
border-color: #177ddc;
|
|
box-shadow: 0 0 0 2px rgba(23, 125, 220, 0.2);
|
|
}
|
|
|
|
/* 深色模式焦点状态 */
|
|
.date-display:focus {
|
|
border-color: #177ddc;
|
|
box-shadow: 0 0 0 2px rgba(23, 125, 220, 0.2);
|
|
}
|
|
|
|
/* 深色模式按下状态 */
|
|
.date-display:active {
|
|
background-color: #2d2d2d;
|
|
border-color: #666;
|
|
}
|
|
|
|
.date-separator {
|
|
color: #888;
|
|
}
|
|
} |