2016-04-27 20:44:36 +08:00
|
|
|
@import "../../style/mixins/index";
|
|
|
|
|
2016-09-14 16:18:33 +08:00
|
|
|
.antCheckboxFn(@checkbox-prefix-cls: ~"@{ant-prefix}-checkbox") {
|
2016-04-27 20:44:36 +08:00
|
|
|
@checkbox-inner-prefix-cls: ~"@{checkbox-prefix-cls}-inner";
|
|
|
|
// 一般状态
|
|
|
|
.@{checkbox-prefix-cls} {
|
2017-09-22 18:33:29 +08:00
|
|
|
.reset-component;
|
2016-04-27 20:44:36 +08:00
|
|
|
white-space: nowrap;
|
|
|
|
cursor: pointer;
|
|
|
|
outline: none;
|
|
|
|
display: inline-block;
|
|
|
|
line-height: 1;
|
|
|
|
position: relative;
|
2017-09-21 18:12:53 +08:00
|
|
|
vertical-align: middle;
|
2017-09-27 22:32:49 +08:00
|
|
|
top: -0.09em;
|
2016-04-27 20:44:36 +08:00
|
|
|
|
2017-03-29 11:24:35 +08:00
|
|
|
.@{checkbox-prefix-cls}-wrapper:hover &-inner,
|
2017-02-28 11:37:29 +08:00
|
|
|
&:hover &-inner,
|
|
|
|
&-input:focus + &-inner {
|
|
|
|
border-color: @primary-color;
|
2016-04-27 20:44:36 +08:00
|
|
|
}
|
|
|
|
|
2017-07-02 19:14:56 +08:00
|
|
|
&-checked:after {
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
border-radius: @border-radius-sm;
|
|
|
|
border: 1px solid @primary-color;
|
|
|
|
content: '';
|
|
|
|
animation: antCheckboxEffect 0.36s ease-in-out;
|
|
|
|
animation-fill-mode: both;
|
|
|
|
visibility: hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:hover:after,
|
|
|
|
.@{checkbox-prefix-cls}-wrapper:hover &:after {
|
|
|
|
visibility: visible;
|
|
|
|
}
|
|
|
|
|
2016-04-27 20:44:36 +08:00
|
|
|
&-inner {
|
2016-11-01 00:54:47 +08:00
|
|
|
position: relative;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
2017-02-22 21:22:42 +08:00
|
|
|
display: block;
|
2017-09-23 18:18:47 +08:00
|
|
|
width: @checkbox-size;
|
|
|
|
height: @checkbox-size;
|
2017-01-31 16:05:10 +08:00
|
|
|
border: @border-width-base @border-style-base @border-color-base;
|
2017-02-08 14:21:29 +08:00
|
|
|
border-radius: @border-radius-sm;
|
2016-11-01 00:54:47 +08:00
|
|
|
background-color: #fff;
|
|
|
|
transition: all .3s;
|
|
|
|
|
2016-04-27 20:44:36 +08:00
|
|
|
&:after {
|
2017-09-23 18:18:47 +08:00
|
|
|
@check-width: (@checkbox-size / 14) * 5px;
|
|
|
|
@check-height: (@checkbox-size / 14) * 8px;
|
2016-04-27 20:44:36 +08:00
|
|
|
transform: rotate(45deg) scale(0);
|
|
|
|
position: absolute;
|
2017-09-23 18:18:47 +08:00
|
|
|
left: (@checkbox-size - @check-width) / 2 - 0.5px * (@checkbox-size / 14);
|
|
|
|
top: (@checkbox-size - @check-height) / 2 - 2px * (@checkbox-size / 14);
|
2016-04-27 20:44:36 +08:00
|
|
|
display: table;
|
2017-09-23 18:18:47 +08:00
|
|
|
width: @check-width;
|
|
|
|
height: @check-height;
|
2016-04-27 20:44:36 +08:00
|
|
|
border: 2px solid #fff;
|
|
|
|
border-top: 0;
|
|
|
|
border-left: 0;
|
|
|
|
content: ' ';
|
|
|
|
transition: all .1s @ease-in-back;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
&-input {
|
|
|
|
position: absolute;
|
|
|
|
left: 0;
|
|
|
|
z-index: 1;
|
|
|
|
cursor: pointer;
|
2017-09-08 13:08:46 +08:00
|
|
|
opacity: 0;
|
2016-04-27 20:44:36 +08:00
|
|
|
top: 0;
|
|
|
|
bottom: 0;
|
|
|
|
right: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 半选状态
|
2016-11-01 00:54:47 +08:00
|
|
|
.@{checkbox-prefix-cls}-indeterminate .@{checkbox-inner-prefix-cls}:after {
|
2017-09-23 18:18:47 +08:00
|
|
|
@indeterminate-width: (@checkbox-size / 14) * 8px;
|
|
|
|
@indeterminate-height: (@checkbox-size / 14) * 1px;
|
2016-11-01 00:54:47 +08:00
|
|
|
content: ' ';
|
|
|
|
transform: scale(1);
|
|
|
|
position: absolute;
|
2017-09-23 18:18:47 +08:00
|
|
|
left: (@checkbox-size - 2 - @indeterminate-width) / 2;
|
|
|
|
top: (@checkbox-size - 3 - @indeterminate-height) / 2;
|
|
|
|
width: @indeterminate-width;
|
|
|
|
height: @indeterminate-height;
|
2016-11-01 00:54:47 +08:00
|
|
|
}
|
|
|
|
|
2017-07-28 13:10:02 +08:00
|
|
|
.@{checkbox-prefix-cls}-indeterminate.@{checkbox-prefix-cls}-disabled .@{checkbox-inner-prefix-cls}:after {
|
|
|
|
border-color: @disabled-color;
|
|
|
|
}
|
|
|
|
|
2016-11-01 00:54:47 +08:00
|
|
|
// 选中状态
|
|
|
|
.@{checkbox-prefix-cls}-checked .@{checkbox-inner-prefix-cls}:after {
|
|
|
|
transform: rotate(45deg) scale(1);
|
|
|
|
position: absolute;
|
|
|
|
display: table;
|
|
|
|
border: 2px solid #fff;
|
|
|
|
border-top: 0;
|
|
|
|
border-left: 0;
|
|
|
|
content: ' ';
|
|
|
|
transition: all .2s @ease-out-back .1s;
|
|
|
|
}
|
|
|
|
|
|
|
|
.@{checkbox-prefix-cls}-checked,
|
2016-04-27 20:44:36 +08:00
|
|
|
.@{checkbox-prefix-cls}-indeterminate {
|
|
|
|
.@{checkbox-inner-prefix-cls} {
|
|
|
|
background-color: @primary-color;
|
2016-11-09 20:38:57 +08:00
|
|
|
border-color: @primary-color;
|
2016-04-27 20:44:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.@{checkbox-prefix-cls}-disabled {
|
2017-06-01 16:54:47 +08:00
|
|
|
cursor: not-allowed;
|
|
|
|
|
2016-04-27 20:44:36 +08:00
|
|
|
&.@{checkbox-prefix-cls}-checked {
|
2016-11-01 00:54:47 +08:00
|
|
|
.@{checkbox-inner-prefix-cls}:after {
|
|
|
|
animation-name: none;
|
2017-01-01 22:20:06 +08:00
|
|
|
border-color: @disabled-color;
|
2016-04-27 20:44:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-27 20:47:18 +08:00
|
|
|
.@{checkbox-prefix-cls}-input {
|
|
|
|
cursor: not-allowed;
|
|
|
|
}
|
|
|
|
|
2016-04-27 20:44:36 +08:00
|
|
|
.@{checkbox-inner-prefix-cls} {
|
2017-08-04 17:58:32 +08:00
|
|
|
border-color: @border-color-base !important;
|
2017-04-29 04:04:41 +08:00
|
|
|
background-color: @input-disabled-bg;
|
2016-04-27 20:44:36 +08:00
|
|
|
&:after {
|
|
|
|
animation-name: none;
|
2017-04-29 04:04:41 +08:00
|
|
|
border-color: @input-disabled-bg;
|
2016-04-27 20:44:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-23 11:15:24 +08:00
|
|
|
& + span {
|
2017-01-01 22:20:06 +08:00
|
|
|
color: @disabled-color;
|
2016-11-08 20:45:56 +08:00
|
|
|
cursor: not-allowed;
|
2016-06-23 11:15:24 +08:00
|
|
|
}
|
2016-04-27 20:44:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
.@{checkbox-prefix-cls}-wrapper {
|
2017-09-22 18:33:29 +08:00
|
|
|
.reset-component;
|
2017-09-27 22:32:49 +08:00
|
|
|
line-height: unset;
|
2016-04-27 20:44:36 +08:00
|
|
|
cursor: pointer;
|
2016-06-22 18:08:52 +08:00
|
|
|
display: inline-block;
|
2017-09-25 20:02:33 +08:00
|
|
|
& + & {
|
|
|
|
margin-left: 8px;
|
2016-06-27 14:52:46 +08:00
|
|
|
}
|
2016-04-27 20:44:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
.@{checkbox-prefix-cls}-wrapper + span,
|
|
|
|
.@{checkbox-prefix-cls} + span {
|
2016-11-01 00:54:47 +08:00
|
|
|
padding-left: 8px;
|
|
|
|
padding-right: 8px;
|
2016-04-27 20:44:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
.@{checkbox-prefix-cls}-group {
|
2017-09-22 18:33:29 +08:00
|
|
|
.reset-component;
|
2016-04-27 20:44:36 +08:00
|
|
|
&-item {
|
|
|
|
display: inline-block;
|
2017-10-17 11:06:25 +08:00
|
|
|
margin-right: 8px;
|
|
|
|
&:last-child {
|
|
|
|
margin-right: 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
&-item + &-item {
|
|
|
|
margin-left: 0;
|
2016-04-27 20:44:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-07-02 19:14:56 +08:00
|
|
|
|
|
|
|
@keyframes antCheckboxEffect {
|
|
|
|
0% {
|
|
|
|
transform: scale(1);
|
|
|
|
opacity: 0.5;
|
|
|
|
}
|
|
|
|
100% {
|
|
|
|
transform: scale(1.6);
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
}
|