2018-12-07 16:17:45 +08:00
|
|
|
@import '../../style/mixins/index';
|
2016-04-27 20:44:36 +08:00
|
|
|
|
2018-12-07 16:17:45 +08:00
|
|
|
.antCheckboxFn(@checkbox-prefix-cls: ~'@{ant-prefix}-checkbox') {
|
|
|
|
@checkbox-inner-prefix-cls: ~'@{checkbox-prefix-cls}-inner';
|
2016-04-27 20:44:36 +08:00
|
|
|
// 一般状态
|
|
|
|
.@{checkbox-prefix-cls} {
|
2020-12-22 11:08:12 +08:00
|
|
|
.reset-component();
|
2019-04-15 10:52:00 +08:00
|
|
|
|
2019-02-15 10:48:07 +08:00
|
|
|
position: relative;
|
2021-03-17 14:56:32 +08:00
|
|
|
top: 0.2em;
|
2016-04-27 20:44:36 +08:00
|
|
|
line-height: 1;
|
2019-02-15 10:48:07 +08:00
|
|
|
white-space: nowrap;
|
|
|
|
outline: none;
|
|
|
|
cursor: pointer;
|
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 {
|
2018-01-18 10:22:03 +08:00
|
|
|
border-color: @checkbox-color;
|
2016-04-27 20:44:36 +08:00
|
|
|
}
|
|
|
|
|
2019-02-15 10:48:07 +08:00
|
|
|
&-checked::after {
|
2017-07-02 19:14:56 +08:00
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
2018-01-18 10:22:03 +08:00
|
|
|
border: 1px solid @checkbox-color;
|
2019-11-15 10:01:35 +08:00
|
|
|
border-radius: @border-radius-base;
|
2019-02-15 10:48:07 +08:00
|
|
|
visibility: hidden;
|
2017-07-02 19:14:56 +08:00
|
|
|
animation: antCheckboxEffect 0.36s ease-in-out;
|
2019-08-02 23:16:45 +08:00
|
|
|
animation-fill-mode: backwards;
|
2019-02-15 10:48:07 +08:00
|
|
|
content: '';
|
2017-07-02 19:14:56 +08:00
|
|
|
}
|
|
|
|
|
2019-02-15 10:48:07 +08:00
|
|
|
&:hover::after,
|
|
|
|
.@{checkbox-prefix-cls}-wrapper:hover &::after {
|
2017-07-02 19:14:56 +08:00
|
|
|
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;
|
2020-03-26 15:14:17 +08:00
|
|
|
direction: ltr;
|
2019-11-26 23:38:26 +08:00
|
|
|
background-color: @checkbox-check-bg;
|
2018-11-13 22:48:44 +08:00
|
|
|
border: @checkbox-border-width @border-style-base @border-color-base;
|
2021-07-12 19:50:13 +08:00
|
|
|
border-radius: @checkbox-border-radius;
|
2018-10-27 17:33:36 +08:00
|
|
|
// Fix IE checked style
|
|
|
|
// https://github.com/ant-design/ant-design/issues/12597
|
|
|
|
border-collapse: separate;
|
2019-02-15 10:48:07 +08:00
|
|
|
transition: all 0.3s;
|
2016-11-01 00:54:47 +08:00
|
|
|
|
2019-02-15 10:48:07 +08:00
|
|
|
&::after {
|
2017-09-23 18:18:47 +08:00
|
|
|
@check-width: (@checkbox-size / 14) * 5px;
|
|
|
|
@check-height: (@checkbox-size / 14) * 8px;
|
2019-04-15 10:52:00 +08:00
|
|
|
|
2016-04-27 20:44:36 +08:00
|
|
|
position: absolute;
|
2019-01-29 14:27:56 +08:00
|
|
|
top: 50%;
|
2021-08-09 16:58:49 +08:00
|
|
|
// https://github.com/ant-design/ant-design/pull/19452
|
|
|
|
// https://github.com/ant-design/ant-design/pull/31726
|
|
|
|
left: 21.5%;
|
2016-04-27 20:44:36 +08:00
|
|
|
display: table;
|
2017-09-23 18:18:47 +08:00
|
|
|
width: @check-width;
|
|
|
|
height: @check-height;
|
2018-06-04 11:20:17 +08:00
|
|
|
border: 2px solid @checkbox-check-color;
|
2016-04-27 20:44:36 +08:00
|
|
|
border-top: 0;
|
|
|
|
border-left: 0;
|
2019-02-15 10:48:07 +08:00
|
|
|
transform: rotate(45deg) scale(0) translate(-50%, -50%);
|
2018-08-16 17:42:44 +08:00
|
|
|
opacity: 0;
|
2019-02-15 10:48:07 +08:00
|
|
|
transition: all 0.1s @ease-in-back, opacity 0.1s;
|
|
|
|
content: ' ';
|
2016-04-27 20:44:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
&-input {
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
right: 0;
|
2019-02-15 10:48:07 +08:00
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
z-index: 1;
|
2016-04-27 20:44:36 +08:00
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
2019-02-15 10:48:07 +08:00
|
|
|
cursor: pointer;
|
|
|
|
opacity: 0;
|
2016-04-27 20:44:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-01 00:54:47 +08:00
|
|
|
// 选中状态
|
2019-02-15 10:48:07 +08:00
|
|
|
.@{checkbox-prefix-cls}-checked .@{checkbox-inner-prefix-cls}::after {
|
2016-11-01 00:54:47 +08:00
|
|
|
position: absolute;
|
|
|
|
display: table;
|
2018-06-04 11:20:17 +08:00
|
|
|
border: 2px solid @checkbox-check-color;
|
2016-11-01 00:54:47 +08:00
|
|
|
border-top: 0;
|
|
|
|
border-left: 0;
|
2019-02-15 10:48:07 +08:00
|
|
|
transform: rotate(45deg) scale(1) translate(-50%, -50%);
|
2018-08-16 17:42:44 +08:00
|
|
|
opacity: 1;
|
2019-02-15 10:48:07 +08:00
|
|
|
transition: all 0.2s @ease-out-back 0.1s;
|
|
|
|
content: ' ';
|
2016-11-01 00:54:47 +08:00
|
|
|
}
|
|
|
|
|
2018-08-16 17:42:44 +08:00
|
|
|
.@{checkbox-prefix-cls}-checked {
|
2016-04-27 20:44:36 +08:00
|
|
|
.@{checkbox-inner-prefix-cls} {
|
2018-01-18 10:22:03 +08:00
|
|
|
background-color: @checkbox-color;
|
|
|
|
border-color: @checkbox-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 {
|
2019-02-15 10:48:07 +08:00
|
|
|
.@{checkbox-inner-prefix-cls}::after {
|
2017-01-01 22:20:06 +08:00
|
|
|
border-color: @disabled-color;
|
2019-02-15 10:48:07 +08:00
|
|
|
animation-name: none;
|
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-04-29 04:04:41 +08:00
|
|
|
background-color: @input-disabled-bg;
|
2019-02-15 10:48:07 +08:00
|
|
|
border-color: @border-color-base !important;
|
|
|
|
&::after {
|
2017-04-29 04:04:41 +08:00
|
|
|
border-color: @input-disabled-bg;
|
2018-10-08 12:17:03 +08:00
|
|
|
border-collapse: separate;
|
2019-02-15 10:48:07 +08:00
|
|
|
animation-name: none;
|
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
|
|
|
}
|
2019-08-14 18:19:07 +08:00
|
|
|
|
|
|
|
// Not show highlight border of checkbox when disabled
|
|
|
|
&:hover::after,
|
|
|
|
.@{checkbox-prefix-cls}-wrapper:hover &::after {
|
|
|
|
visibility: hidden;
|
|
|
|
}
|
2016-04-27 20:44:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
.@{checkbox-prefix-cls}-wrapper {
|
2020-12-22 11:08:12 +08:00
|
|
|
.reset-component();
|
2021-03-17 14:56:32 +08:00
|
|
|
display: inline-flex;
|
|
|
|
align-items: baseline;
|
2017-09-27 22:32:49 +08:00
|
|
|
line-height: unset;
|
2016-04-27 20:44:36 +08:00
|
|
|
cursor: pointer;
|
2021-03-17 14:56:32 +08:00
|
|
|
|
2021-04-22 20:15:23 +08:00
|
|
|
&::after {
|
|
|
|
display: inline-block;
|
|
|
|
width: 0;
|
|
|
|
overflow: hidden;
|
|
|
|
content: '\a0';
|
|
|
|
}
|
|
|
|
|
2019-10-25 11:37:30 +08:00
|
|
|
&.@{checkbox-prefix-cls}-wrapper-disabled {
|
|
|
|
cursor: not-allowed;
|
|
|
|
}
|
2021-03-17 14:56:32 +08:00
|
|
|
|
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} + span {
|
2016-11-01 00:54:47 +08:00
|
|
|
padding-right: 8px;
|
2019-02-15 10:48:07 +08:00
|
|
|
padding-left: 8px;
|
2016-04-27 20:44:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
.@{checkbox-prefix-cls}-group {
|
2020-12-22 11:08:12 +08:00
|
|
|
.reset-component();
|
2017-12-27 10:18:48 +08:00
|
|
|
display: inline-block;
|
2021-03-17 14:56:32 +08:00
|
|
|
|
2016-04-27 20:44:36 +08:00
|
|
|
&-item {
|
2020-04-28 11:16:01 +08:00
|
|
|
margin-right: @checkbox-group-item-margin-right;
|
2017-10-17 11:06:25 +08:00
|
|
|
&:last-child {
|
|
|
|
margin-right: 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
&-item + &-item {
|
|
|
|
margin-left: 0;
|
2016-04-27 20:44:36 +08:00
|
|
|
}
|
|
|
|
}
|
2018-10-19 11:12:33 +08:00
|
|
|
|
|
|
|
// 半选状态
|
|
|
|
.@{checkbox-prefix-cls}-indeterminate {
|
|
|
|
.@{checkbox-inner-prefix-cls} {
|
2020-02-24 22:44:29 +08:00
|
|
|
background-color: @checkbox-check-bg;
|
2018-10-19 11:12:33 +08:00
|
|
|
border-color: @border-color-base;
|
|
|
|
}
|
2019-02-15 10:48:07 +08:00
|
|
|
.@{checkbox-inner-prefix-cls}::after {
|
2018-10-19 11:12:33 +08:00
|
|
|
@indeterminate-width: @checkbox-size - 8px;
|
|
|
|
@indeterminate-height: @checkbox-size - 8px;
|
2019-04-15 10:52:00 +08:00
|
|
|
|
2018-10-19 11:12:33 +08:00
|
|
|
top: 50%;
|
2019-02-15 10:48:07 +08:00
|
|
|
left: 50%;
|
2018-10-19 11:12:33 +08:00
|
|
|
width: @indeterminate-width;
|
|
|
|
height: @indeterminate-height;
|
|
|
|
background-color: @checkbox-color;
|
2019-02-15 10:48:07 +08:00
|
|
|
border: 0;
|
|
|
|
transform: translate(-50%, -50%) scale(1);
|
2018-10-19 11:12:33 +08:00
|
|
|
opacity: 1;
|
2019-02-15 10:48:07 +08:00
|
|
|
content: ' ';
|
2018-10-19 11:12:33 +08:00
|
|
|
}
|
|
|
|
|
2019-02-15 10:48:07 +08:00
|
|
|
&.@{checkbox-prefix-cls}-disabled .@{checkbox-inner-prefix-cls}::after {
|
2018-10-19 11:12:33 +08:00
|
|
|
background-color: @disabled-color;
|
2019-02-15 10:48:07 +08:00
|
|
|
border-color: @disabled-color;
|
2018-10-19 11:12:33 +08:00
|
|
|
}
|
|
|
|
}
|
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;
|
|
|
|
}
|
|
|
|
}
|