amis2/scss/components/form/_checks.scss

595 lines
12 KiB
SCSS
Raw Normal View History

2019-04-30 11:11:25 +08:00
.#{$ns}Checkbox {
2019-12-06 09:58:08 +08:00
margin: 0 $gap-sm 0 0;
font-weight: $fontWeightNormal;
user-select: none;
2020-05-12 14:17:43 +08:00
pointer-events: none;
2019-12-06 09:58:08 +08:00
input {
position: absolute;
clip: rect(1px 1px 1px 1px);
clip: rect(1px, 1px, 1px, 1px);
pointer-events: none;
2019-12-06 09:58:08 +08:00
}
&:hover input:not(:disabled) + i {
border-color: $Checkbox-onHover-color;
// box-shadow: 0 0 px2rem(1px) $Checkbox-onHover-color inset;
}
> i {
cursor: pointer;
line-height: 1;
background: $Checkbox-gb;
display: inline-block;
vertical-align: middle;
position: relative;
2020-05-12 14:17:43 +08:00
pointer-events: all;
2019-12-06 09:58:08 +08:00
+ span {
2020-05-12 14:17:43 +08:00
pointer-events: all;
2019-12-06 09:58:08 +08:00
margin-left: $Checkbox-gap;
cursor: pointer;
2020-03-26 11:36:41 +08:00
> a {
float: right;
margin-left: px2rem(5px);
display: none;
}
2019-12-06 09:58:08 +08:00
&:empty {
display: none;
}
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&:before {
content: '';
position: absolute;
left: 50%;
top: 50%;
width: 0px;
height: 0px;
background-color: transparent;
transition: all 0.2s;
transform-origin: 50% 50%;
transform: translate(-50%, -50%);
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
2020-03-26 11:36:41 +08:00
&:hover > i + span > a {
display: inline-block;
}
2019-12-06 09:58:08 +08:00
&--checkbox {
padding-left: $Checkbox-size;
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
input {
margin-left: -$Checkbox-size;
&:checked + i {
2019-04-30 11:11:25 +08:00
border-color: $Checkbox-onHover-color;
2019-12-06 09:58:08 +08:00
&:before {
width: $Checkbox-inner-size;
height: $Checkbox-inner-size;
background: $Checkbox-onHover-color;
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
&[disabled] + i {
border-color: lighten($Checkbox-color, 5%);
cursor: not-allowed;
2019-04-30 11:11:25 +08:00
&:before {
2019-12-06 09:58:08 +08:00
background-color: lighten($Checkbox-color, 5%);
border-color: $white;
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&[disabled] + i + span {
cursor: not-allowed;
color: $text--muted-color;
}
}
2019-12-06 09:58:08 +08:00
> i {
width: $Checkbox-size;
height: $Checkbox-size;
border: px2rem(1px) solid $Checkbox-color;
border-radius: $Checkbox-borderRadius;
margin-left: -$Checkbox-size;
margin-top: px2rem(-3px);
}
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&--full.#{$ns}Checkbox--checkbox {
&:not(:disabled) + i:hover {
border-color: $Checkbox-color;
}
2019-12-06 09:58:08 +08:00
input {
&:checked + i {
border-color: $Checkbox-onHover-color;
background: $Checkbox-onHover-color;
2019-12-06 09:58:08 +08:00
&:before {
width: $Checkbox--full-inner-size;
height: $Checkbox--full-inner-size / 2;
border-color: $white;
}
}
2019-12-06 09:58:08 +08:00
// &[disabled] + i {
// border-color: lighten($Checkbox-color, 5%);
2019-06-20 18:10:40 +08:00
2019-12-06 09:58:08 +08:00
// &:before {
// background-color: lighten($Checkbox-color, 5%);
// }
// }
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&:checked[disabled] + i {
border-color: lighten($Checkbox-color, 5%);
background-color: lighten($Checkbox-color, 5%);
}
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
> i {
position: relative;
cursor: pointer;
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&:before {
content: '';
position: absolute;
left: 50%;
top: 50%;
width: 0;
height: 0;
border-color: transparent;
transition: width 0.2s, height 0.2s, transform 0.2s;
border-width: 0 0 px2rem(2px) px2rem(2px);
transform: translate(-50%, -60%) rotate(-40deg);
border-style: solid;
}
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&--radio {
padding-left: $Radio-size;
2019-12-06 09:58:08 +08:00
input {
margin-left: -$Radio-size;
2019-12-06 09:58:08 +08:00
&:checked + i {
border-color: $Radio-onHover-color;
2019-12-06 09:58:08 +08:00
&:before {
width: $Radio-inner-size;
height: $Radio-inner-size;
background-color: $Radio-onHover-color;
border-radius: 50%;
}
}
2019-12-06 09:58:08 +08:00
&[disabled] + i {
border-color: lighten($Radio-color, 5%);
cursor: not-allowed;
2019-06-20 18:10:40 +08:00
2019-12-06 09:58:08 +08:00
&:before {
background-color: lighten($Radio-color, 5%);
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&[disabled] + i + span {
cursor: not-allowed;
color: $text--muted-color;
}
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
> i {
cursor: pointer;
width: $Radio-size;
height: $Radio-size;
border: px2rem(1px) solid $Radio-color;
margin-left: -$Radio-size;
margin-top: px2rem(-2px);
border-radius: 50%;
}
}
&--sm {
padding-left: $Checkbox--sm-size;
2019-12-06 09:58:08 +08:00
input {
margin-left: -$Checkbox--sm-size;
2019-12-06 09:58:08 +08:00
&:checked + i {
&:before {
width: $Checkbox--sm-inner-size;
height: $Checkbox--sm-inner-size;
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
}
2019-12-06 09:58:08 +08:00
> i {
width: $Checkbox--sm-size;
height: $Checkbox--sm-size;
margin-left: -$Checkbox--sm-size;
2020-06-08 18:23:56 +08:00
margin-top: 0;
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
+ span {
margin-left: $gap-xs;
}
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
2019-09-17 21:53:32 +08:00
2019-12-06 09:58:08 +08:00
&--sm.#{$ns}Checkbox--full {
2020-05-29 13:18:27 +08:00
input[type='checkbox'] {
2019-12-06 09:58:08 +08:00
&:checked + i {
&:before {
width: $Checkbox--sm--full-inner-size;
height: $Checkbox--sm--full-inner-size / 2;
}
2019-12-06 09:58:08 +08:00
}
}
2019-12-06 09:58:08 +08:00
}
2019-12-06 09:58:08 +08:00
&-desc {
color: $text--muted-color;
margin-left: $Checkbox-gap;
margin-top: $gap-xs;
2020-05-12 14:17:43 +08:00
pointer-events: all;
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
}
.#{$ns}CheckboxControl,
.#{$ns}RadiosControl,
2019-04-30 11:11:25 +08:00
.#{$ns}CheckboxesControl {
2019-12-06 09:58:08 +08:00
padding-top: ($Form-input-height - $Checkbox-size) / 2;
2019-04-30 11:11:25 +08:00
}
.#{$ns}RadiosControl,
.#{$ns}CheckboxesControl {
2019-12-06 09:58:08 +08:00
.#{$ns}Checkbox {
display: block;
margin-bottom: $Form-label-paddingTop;
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&.is-inline .#{$ns}Checkbox {
display: inline-block;
margin-right: $gap-md;
}
}
.#{$ns}RadiosControl-group,
.#{$ns}CheckboxesControl-group {
2019-12-06 09:58:08 +08:00
.#{$ns}RadiosControl-group,
.#{$ns}CheckboxesControl-group {
padding-left: px2rem(80px);
@include clearfix();
> .#{$ns}RadiosControl-groupLabel,
> .#{$ns}CheckboxesControl-groupLabel {
float: left;
width: px2rem(80px);
margin-left: px2rem(-80px);
2019-06-17 01:00:21 +08:00
}
2019-12-06 09:58:08 +08:00
}
}
.#{$ns}RadiosControl-groupLabel,
.#{$ns}CheckboxesControl-groupLabel {
2019-12-06 09:58:08 +08:00
display: block;
}
2020-03-26 11:36:41 +08:00
.#{$ns}Checkboxes {
2020-05-12 14:17:43 +08:00
> .#{$ns}Checkbox {
display: block;
height: $Form-input-height;
line-height: $Form-input-lineHeight;
font-size: $Form-input-fontSize;
padding: (
$Form-input-height - $Form-input-lineHeight * $Form-input-fontSize
)/2 $gap-sm
($Form-input-height - $Form-input-lineHeight * $Form-input-fontSize)/2
($gap-sm + $Checkbox-size);
}
&--inline > .#{$ns}Checkbox {
display: inline-block;
}
2020-03-26 11:36:41 +08:00
&-addBtn {
display: block;
cursor: pointer;
&:hover {
text-decoration: none;
}
> svg {
width: px2rem(14px);
height: px2rem(14px);
margin-right: $Checkbox-gap;
}
}
}
2020-05-29 13:18:27 +08:00
.#{$ns}ListCheckboxes,
.#{$ns}ListRadios {
2020-05-26 20:28:09 +08:00
&-group:not(:first-child) > &-itemLabel {
border-top: px2rem(1px) solid $ListMenu-divider-color;
}
2020-05-13 12:35:21 +08:00
&-group > &-itemLabel {
font-size: $fontSizeSm;
padding: $gap-xs $gap-xs;
color: $text--muted-color;
}
&-item {
display: flex;
height: $Form-input-height;
line-height: $Form-input-lineHeight;
font-size: $Form-input-fontSize;
padding: (
$Form-input-height - $Form-input-lineHeight * $Form-input-fontSize
)/2 $gap-sm;
flex-direction: row;
> .#{$ns}Checkbox {
margin-right: 0;
}
cursor: pointer;
user-select: none;
2020-05-29 15:28:43 +08:00
&.is-active {
color: $Form-select-menu-onActive-color;
background-color: $Form-select-menu-onActive-bg;
}
2020-05-13 12:35:21 +08:00
&:hover {
background-color: $Tree-item-onHover-bg;
}
&.is-disabled {
pointer-events: none;
color: $text--muted-color;
}
}
2020-05-13 12:35:21 +08:00
&-group > &-items > &-item {
padding-left: $gap-base;
}
&-itemLabel {
flex-grow: 1;
}
2020-05-13 20:36:08 +08:00
&-placeholder {
2020-05-27 10:57:48 +08:00
@include checkboxes-placeholder();
2020-05-13 20:36:08 +08:00
}
}
.#{$ns}TableCheckboxes {
2020-05-27 13:52:25 +08:00
.#{$ns}Table-content {
border-top: $Table-borderWidth solid $Table-borderColor;
}
2020-05-13 19:28:46 +08:00
.#{$ns}Table-table > thead > tr > th,
.#{$ns}Table-table > tbody > tr > td {
font-size: $fontSizeSm;
padding-top: px2rem(5px);
padding-bottom: px2rem(6px);
vertical-align: middle;
}
.#{$ns}Table-table > thead > tr > th {
padding-top: px2rem(6px);
}
.#{$ns}Table-table > thead > tr > th:first-child,
.#{$ns}Table-table > tbody > tr > td:first-child {
padding-left: px2rem(10px);
padding-right: 0;
}
.#{$ns}Table-table > thead > tr > th:last-child,
.#{$ns}Table-table > tbody > tr > td:last-child {
padding-right: px2rem(15px);
}
.#{$ns}Table-table > tbody > tr {
cursor: pointer;
}
}
2020-05-13 11:00:01 +08:00
2020-05-29 13:18:27 +08:00
.#{$ns}TreeCheckboxes,
.#{$ns}TreeRadios {
2020-05-13 11:00:01 +08:00
.#{$ns}Table-expandBtn {
color: $icon-color;
margin-right: 5px;
}
&-sublist {
position: relative;
2020-05-13 11:31:31 +08:00
margin: 0 0 0 px2rem(35px);
display: none;
2020-05-13 11:00:01 +08:00
&:before {
width: 1px;
content: '';
display: block;
position: absolute;
2020-05-13 11:31:31 +08:00
top: px2rem(-5px);
bottom: $Form-input-height / 2;
2020-05-13 11:00:01 +08:00
left: -19px;
border-left: dashed 1px $icon-color;
}
}
&-item {
position: relative;
2020-05-29 13:18:27 +08:00
}
&-item.is-expanded > &-sublist {
display: block;
2020-05-13 11:00:01 +08:00
}
2020-05-26 20:28:09 +08:00
&-item:not(:last-child) > &-sublist:before {
bottom: 0;
}
2020-05-13 11:00:01 +08:00
&-sublist &-item:before {
height: 1px;
content: '';
display: block;
position: absolute;
2020-05-13 11:31:31 +08:00
top: $Form-input-height / 2;
2020-05-13 11:00:01 +08:00
width: 19px;
left: -19px;
border-top: dashed 1px $icon-color;
}
&-itemInner {
display: flex;
align-items: center;
2020-05-13 11:00:01 +08:00
height: $Form-input-height;
line-height: $Form-input-lineHeight;
font-size: $Form-input-fontSize;
padding: (
$Form-input-height - $Form-input-lineHeight * $Form-input-fontSize
)/2 $gap-sm;
flex-direction: row;
> .#{$ns}Checkbox {
margin-right: 0;
margin-left: $gap-sm;
2020-05-13 11:00:01 +08:00
}
cursor: pointer;
user-select: none;
2020-05-29 13:18:27 +08:00
&.is-active {
color: $Form-select-menu-onActive-color;
background-color: $Form-select-menu-onActive-bg;
}
2020-05-29 15:28:43 +08:00
&:hover {
background-color: $Tree-item-onHover-bg;
}
2020-05-13 11:00:01 +08:00
&.is-disabled {
pointer-events: none;
color: $text--muted-color;
}
}
&-itemLabel {
flex-grow: 1;
}
2020-05-26 20:28:09 +08:00
&-placeholder {
2020-05-27 10:57:48 +08:00
@include checkboxes-placeholder();
}
}
2020-05-27 13:52:25 +08:00
.#{$ns}ChainedCheckboxes {
2020-05-27 10:57:48 +08:00
display: flex;
flex-direction: row;
&-col {
flex-grow: 1;
min-width: 150px;
2020-05-27 10:57:48 +08:00
}
&-col:not(:last-child) {
border-right: 1px solid $borderColor;
}
2020-05-27 13:52:25 +08:00
&-subTitle {
font-size: $fontSizeSm;
padding: $gap-xs $gap-xs;
color: $text--muted-color;
}
2020-05-27 10:57:48 +08:00
&-item {
display: flex;
2020-05-26 20:28:09 +08:00
height: $Form-input-height;
line-height: $Form-input-lineHeight;
font-size: $Form-input-fontSize;
padding: (
$Form-input-height - $Form-input-lineHeight * $Form-input-fontSize
)/2 $gap-sm;
2020-05-27 10:57:48 +08:00
flex-direction: row;
> .#{$ns}Checkbox {
margin-right: 0;
}
cursor: pointer;
user-select: none;
&.is-active {
color: $Form-select-menu-onActive-color;
background-color: $Form-select-menu-onActive-bg;
}
2020-05-29 15:28:43 +08:00
&:hover {
background-color: $Tree-item-onHover-bg;
}
2020-05-27 10:57:48 +08:00
&.is-disabled {
pointer-events: none;
color: $text--muted-color;
}
}
&-itemLabel {
flex-grow: 1;
}
&-placeholder {
@include checkboxes-placeholder();
2020-05-26 20:28:09 +08:00
}
2020-05-13 11:00:01 +08:00
}
2020-05-29 13:18:27 +08:00
.#{$ns}AssociatedCheckboxes {
display: flex;
flex-direction: row;
&-left,
&-right {
flex-grow: 1;
width: 0;
overflow: auto;
}
&-left {
border-right: 1px solid $borderColor;
}
2020-05-29 18:02:03 +08:00
&-reload {
text-align: center;
color: $info;
margin: 20px 0 0;
&.is-clickable {
cursor: pointer;
}
}
&-box {
line-height: $Form-input-lineHeight;
font-size: $fontSizeSm;
color: $text--muted-color;
flex-grow: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
> p {
text-align: center;
margin: 10px 0 20px;
color: $text--muted-color;
}
2020-05-29 13:18:27 +08:00
}
}