﻿/**
 * ud2-date.less
 * 日期控件的默认样式
 */

// 导入必要的文件
@import "../../../common/import.less";

// 日期控件主容器
.ud2-date {
	padding-left: @CtrlPaddingLR;
	padding-right: 2em;

	// 设置控件开启样式
	&.on {
		// 列表开启后的外层样式
		.ud2-date-list {
			display: block;
		}
	}
}
// 设置控件的列表外层样式
.ud2-date-list {
	display: none;
	position: absolute;
	top: @CtrlHeight + 4;
	left: -1px;
	width: 100%;
	min-width: 240px;
	border: 1px solid @ColorWhiteBackDark;
	border-radius: @BorderRadius;
	background: @ColorWhite;
	box-shadow: @CtrlShadow;
	.boxSizing();

	table {
		width: 100%;
		table-layout: fixed;

		th {
			background: @ColorWhiteBackLight;
		}

		td, th {
			text-align: center;
			line-height: 2.4em;
		}

		td div {
			float: left;
			width: 50%;
		}

		td[ud2-date-date], div[ud2-date-month], div[ud2-date-year] {
			cursor: pointer;
			outline: 1px solid transparent;
			outline-offset: -5px;
			.transition(all .3s);

			&:hover {
				color: @ColorGreen;
				outline-color: @ColorWhiteBorder;
				background: @ColorWhiteBackLight;
				outline-offset: -1px;
			}
		}

		td[ud2-date-now], div[ud2-date-now] {
			color: @ColorBlue;
			outline-color: @ColorBlueBorder;
			outline-offset: -1px;
			background: @ColorBlueBackLight;
		}

		td[ud2-date-today] {
			position: relative;
			&::before {
				position: absolute;
				right: .2em;
				bottom: .2em;
				content: '';
				display: block;
				width: 0;
				height: 0;
				border: .3em solid @ColorGreen;
				border-left: .3em dashed transparent;
				border-top: .3em dashed transparent;
			}
		}
	}
}
// 设置控件的日期容器样式
.ud2-date-datelist {
	position: relative;
}
// 设置控件的工具容器样式
.ud2-date-tools {
	padding: .25em 0;
	background: @ColorWhiteBackLight;
}
// 设置控件的按钮组容器样式
.ud2-date-btns {
	padding-bottom: .5em;
	text-align: center;

	.btn {
		padding: 0 1em;
	}
}
// 设置控件的两侧工具样式
.ud2-date-tools-left, .ud2-date-tools-right {
	position: absolute;
	top: 2px;

	.ico {
		display: inline-block; 
		width: 2em;
		font-size: 12px;
		text-align: center;
		color: @ColorTextNoImport;
		cursor: pointer;
		.transition(color .3s);

		&:hover {
			color: @ColorBlue;
		}
	}
}
// 设置控件的左侧容器边距
.ud2-date-tools-left {
	left: .25em;
}
// 设置控件的右侧容器边距
.ud2-date-tools-right {
	right: .25em;
}
// 设置控件的工具文本样式
.ud2-date-tools-text {
	font-weight: 800;
	text-align: center;
	cursor: pointer;
}
// 设置控件的年月容器样式
.ud2-date-ymlist {
	display: none;
	position: relative;

	table {
		margin: .25em 0;
		td:first-child {
			border-right: 1px solid @ColorWhiteBorder;
		}
		td:last-child {
			border-left: 1px solid @ColorWhiteBorder;
		}
	}
}
// 设置非本月日期样式
.ud2-date-nomonth {
	opacity: @OpacityNoImport;
}
// 设置周末样式
.ud2-date-weekend {
	color: @ColorRed;
}
// 设置控件的小尺寸方案
.ud2-date.sm, .ctrl-group.sm {
	.ud2-date-list {
		top: @CtrlHeight;
	}

	.ud2-date-tools-left, .ud2-date-tools-right {
		.ico {
			.transform(scale(.9));
		}
	}
}
// 设置控件的大尺寸方案
.ud2-date.lg, .ctrl-group.lg {
	.ud2-date-list {
		top: @CtrlHeight + 8;
	}
	
	.ud2-date-tools-left, .ud2-date-tools-right {
		.ico {
			.transform(scale(1.1));
		}
	}
}