amis2/scss/components/form/_tree.scss

299 lines
5.6 KiB
SCSS
Raw Normal View History

2019-04-30 11:11:25 +08:00
.#{$ns}TreeControl {
2019-12-06 09:58:08 +08:00
border: 1px solid $Form-input-borderColor;
padding: 6px 12px;
border-radius: 2px;
max-height: 300px;
overflow: auto;
&.h-full {
max-height: none;
overflow: visible;
}
&.no-border {
border: 0;
}
2019-04-30 11:11:25 +08:00
}
.#{$ns}Tree {
2019-12-06 09:58:08 +08:00
&-list,
&-sublist {
list-style: none;
padding: 0;
margin: 0;
}
&-sublist.is-folded {
display: none;
}
&-item {
line-height: $Tree-itemHeight;
position: relative;
> div {
&:hover {
text-decoration: none;
> .#{$ns}Tree-item-icons {
visibility: visible;
}
2019-12-06 09:58:08 +08:00
}
2019-11-10 11:18:22 +08:00
2019-12-06 09:58:08 +08:00
> span > svg {
display: inline-block;
cursor: pointer;
2019-12-06 09:58:08 +08:00
position: relative;
top: 2px;
width: px2rem(16px);
height: px2rem(16px);
margin-left: px2rem(5px);
}
}
2019-12-06 09:58:08 +08:00
}
2019-12-06 09:58:08 +08:00
&-rootItem {
line-height: $Tree-itemHeight;
}
2019-12-06 09:58:08 +08:00
&-item > div:hover > .#{$ns}Tree-item-icons,
&-rootItem > div:hover > .#{$ns}Tree-item-icons {
visibility: visible;
}
2019-12-06 09:58:08 +08:00
&-itemLabel {
display: flex;
2019-12-06 09:58:08 +08:00
&:hover {
background: $Tree-item-onHover-bg;
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
&-item-icons {
visibility: hidden;
transition: visibility 0.1s ease;
display: inline-block;
vertical-align: top;
height: $Tree-itemHeight;
line-height: $Tree-itemHeight;
2020-06-09 14:44:38 +08:00
padding-right: px2rem(5px);
2019-12-06 09:58:08 +08:00
> a {
display: inline-block;
vertical-align: middle;
margin-left: $gap-xs;
cursor: pointer;
> svg {
2020-06-09 14:44:38 +08:00
$svgSize: px2rem(12px);
2019-12-06 09:58:08 +08:00
width: $svgSize;
height: $svgSize;
2020-06-09 14:44:38 +08:00
top: 0;
2019-12-06 09:58:08 +08:00
}
}
2019-12-06 09:58:08 +08:00
}
2019-12-06 09:58:08 +08:00
&-itemInput {
padding-left: $Tree-itemArrowWidth;
2019-12-06 09:58:08 +08:00
> a {
display: inline-block;
cursor: pointer;
margin-left: $gap-sm;
color: $icon-color;
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&:hover {
color: $icon-onHover-color;
text-decoration: none;
}
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
> input {
outline: none;
background-color: $Form-input-bg;
border: $Form-input-borderWidth solid $Form-input-borderColor;
border-radius: $Form-input-borderRadius;
line-height: $Form-input-lineHeight;
padding: (
$Tree-inputHeight - $Form-input-lineHeight * $Form-input-fontSize -
px2rem(2px)
)/2 $Form-input-paddingX;
font-size: $Form-input-fontSize;
&::placeholder {
color: $Form-input-placeholderColor;
user-select: none;
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&:focus {
border-color: $Form-input-onFocused-borderColor;
box-shadow: $Form-input-boxShadow;
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
@if $Form-input-onFocused-bg !=$Form-input-bg {
background-color: $Form-input-onFocused-bg;
}
2019-12-06 09:58:08 +08:00
}
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
&-addTopBtn {
cursor: pointer;
height: $Tree-itemHeight;
line-height: $Tree-itemHeight;
display: block;
2019-11-10 11:18:22 +08:00
2019-12-06 09:58:08 +08:00
&:hover {
text-decoration: none;
}
2019-12-06 09:58:08 +08:00
&.is-disabled {
pointer-events: none;
color: $text--muted-color;
}
2019-12-06 09:58:08 +08:00
> svg {
$svgSize: px2rem(14px);
width: $svgSize;
height: $svgSize;
top: $svgSize * 0.125;
margin-right: $Tree-itemArrowWidth - px2rem(14px); // icon 的宽度是14px
}
2019-12-06 09:58:08 +08:00
}
&-itemArrow {
cursor: pointer;
width: $Tree-itemArrowWidth;
display: inline-block;
2020-06-11 13:37:17 +08:00
margin-right: px2rem(5px);
2019-12-06 09:58:08 +08:00
2020-06-09 14:44:38 +08:00
// &:before {
// font-style: normal;
// font-family: $Tree-arrowVendor;
// content: $Tree-unfoldedArrowContent;
// }
> svg {
2020-06-11 13:37:17 +08:00
width: $Tree-itemArrowWidth;
height: $Tree-itemArrowWidth;
2020-06-09 14:44:38 +08:00
display: inline-block;
transition: transform 0.2s;
top: 0;
transform: rotate(90deg);
}
2020-06-09 14:44:38 +08:00
&.is-folded > svg {
transform: rotate(0deg);
}
2019-12-06 09:58:08 +08:00
}
&-itemArrowPlaceholder {
display: inline-block;
width: $Tree-itemArrowWidth + px2rem(5px);
2019-12-06 09:58:08 +08:00
}
&-itemIcon {
display: inline-block;
2020-06-11 13:37:17 +08:00
margin-right: px2rem(5px);
2019-12-06 09:58:08 +08:00
}
2020-06-09 14:44:38 +08:00
&-rootIcon,
&-folderIcon,
2019-12-06 09:58:08 +08:00
&-leafIcon {
2020-06-09 14:44:38 +08:00
> svg {
width: px2rem(14px);
height: px2rem(14px);
}
2019-12-06 09:58:08 +08:00
}
2019-12-06 09:58:08 +08:00
&-itemLabel {
user-select: none;
2019-12-06 09:58:08 +08:00
&.is-checked,
&.is-children-checked {
color: $Tree-itemLabel--onChecked-color;
}
2019-12-06 09:58:08 +08:00
&.is-disabled {
color: $text--muted-color;
}
2020-06-09 14:44:38 +08:00
> .#{$ns}Checkbox {
line-height: 1;
2020-06-11 13:37:17 +08:00
display: inline-block;
padding-top: $Form-label-paddingTop - px2rem(1px);
2020-06-09 14:44:38 +08:00
}
2019-12-06 09:58:08 +08:00
}
&-itemText {
cursor: pointer;
flex: 1 auto;
2020-06-11 13:37:17 +08:00
line-height: $lineHeightBase;
padding: px2rem(4px) 0;
2019-12-06 09:58:08 +08:00
}
&-placeholder {
color: $text--muted-color;
}
&-item &-item > &-itemLabel,
&-item &-item > &-placeholder {
padding-left: $Tree-indent;
}
&-item &-item &-item > &-itemLabel,
&-item &-item &-item > &-placeholder {
padding-left: $Tree-indent * 2;
}
&-item &-item &-item &-item > &-itemLabel {
padding-left: $Tree-indent * 3;
}
&-item &-item &-item &-item &-item > &-itemLabel {
padding-left: $Tree-indent * 4;
}
&-item &-item &-item &-item &-item &-item > &-itemLabel {
padding-left: $Tree-indent * 5;
}
&-item &-item &-item &-item &-item &-item &-item > &-itemLabel {
padding-left: $Tree-indent * 6;
}
&-item &-item &-item &-item &-item &-item &-item &-item > &-itemLabel {
padding-left: $Tree-indent * 7;
}
&-item &-item &-item &-item &-item &-item &-item &-item &-item > &-itemLabel {
padding-left: $Tree-indent * 8;
}
&-item
&-item
&-item
&-item
&-item
&-item
&-item
&-item
&-item
&-item
> &-itemLabel {
padding-left: $Tree-indent * 9;
}
&-item
&-item
&-item
&-item
&-item
&-item
&-item
&-item
&-item
&-item
&-item
> &-itemLabel {
padding-left: $Tree-indent * 10;
}
}