v-tree-select
Version:
A Vue.js project
723 lines (649 loc) • 19.6 kB
text/less
@import './mixins/iconfont.less';
@import './mixins/clearfix.less';
@import '../../node_modules/v-tree/src/assets/ant.less';
@select-prefix-cls: v-tree-select;
@primary-color : #108ee9;
@highlight-color : #f04134;
@text-color : #1f2d3d;
@item-hover-bg : #ecf6fd;
@item-select-bg : #d2eafb;
@disabled-color : fade(#000, 25%);
@component-background : #fff;
@tree-showline-icon-color : fade(#000, 43%);
@border-color-base : #bfcbd9; // base border outline a component
@input-height-base : 36px;
@input-placeholder-color : @disabled-color;
@border-radius-base : 4px;
@tag-default-bg : #f3f3f3;
@tag-default-color : @text-color;
@ease-in-out :cubic-bezier(.645,.045,.355,1);
@font-face {font-family: "iconfont";
src: url('./font/iconfont.eot?t=1504433485235'); /* IE9*/
src: url('./font/iconfont.eot?t=1504433485235#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAAAVwAAsAAAAACAQAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADMAAABCsP6z7U9TLzIAAAE8AAAARAAAAFZW7kgaY21hcAAAAYAAAABmAAABnM75allnbHlmAAAB6AAAAYwAAAHM3snJmWhlYWQAAAN0AAAALwAAADYOwzCXaGhlYQAAA6QAAAAcAAAAJAfeA4VobXR4AAADwAAAABAAAAAQD+kAAGxvY2EAAAPQAAAACgAAAAoBXACcbWF4cAAAA9wAAAAfAAAAIAETAF1uYW1lAAAD/AAAAUUAAAJtPlT+fXBvc3QAAAVEAAAAKwAAADzCYNxMeJxjYGRgYOBikGPQYWB0cfMJYeBgYGGAAJAMY05meiJQDMoDyrGAaQ4gZoOIAgCKIwNPAHicY2Bk/sU4gYGVgYOpk+kMAwNDP4RmfM1gxMjBwMDEwMrMgBUEpLmmMDgwVDzTY27438AQw9zA0AAUZgTJAQAnbAyceJzFkMENwCAIRT9iG9P06haNp6YD9dQRnJg1LKAXJ/CbJ/BDxABgA8D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vn8lGvF4kehCblWGP+tsYCjnEFhSUOjDFCGGSIyujoO1Vm9K+xQ8Jee1Y9zed0WxTU/3OFAQL0z1xTurLSeTpPgT1fG1J1dCtuy56UNJFezUkSskJe1rZUQuoBNmVXjhF6XNGJPyhnSP8ACVpuyAAAAHicY2BigAAuBuyAhZGJkZmRhZGVgbGCJSW/PI+9OCMxLzmjlIEBADOSBUkA') format('woff'),
url('./font/iconfont.ttf?t=1504433485235') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
url('./font/iconfont.svg?t=1504433485235#iconfont') format('svg'); /* iOS 4.1- */
}
// input status
// == when focus or actived
.active() {
border-color: #49a9ee;
outline: 0;
box-shadow: 0 0 0 2px rgba(16,142,233,.2);
}
// == when hoverd
.hover(@color: @input-hover-border-color) {
border-color: #49a9ee;
}
.selection__clear() {
display: inline-block;
font-style: normal;
vertical-align: baseline;
text-align: center;
text-transform: none;
text-rendering: auto;
opacity: 0;
position: absolute;
right: 8px;
z-index: 1;
background: @component-background;
top: 50%;
font-size: 14px;
color: @disabled-color;
width: 12px;
height: 12px;
margin-top: -6px;
line-height: 12px;
cursor: pointer;
transition: color 0.3s ease, opacity 0.15s ease;
&:before {
display: block;
.iconfont-font("\e62e");
}
&:hover {
color: @tree-showline-icon-color;
}
}
.@{select-prefix-cls} {
box-sizing: border-box;
display: inline-block;
position: relative;
color: @text-color;
font-size: 14px;
> ul > li > a {
padding: 0;
background-color: @component-background;
}
// arrow
&-arrow {
.iconfont-mixin();
position: absolute;
top: 50%;
right: 6px;
line-height: 1;
margin-top: -6px;
font-size: 14px;
// .iconfont-size-under-12px(9px);
* {
display: none;
}
&:before {
content: '\e615';
transition: transform 0.2s ease;
}
}
&-selection {
outline: none;
user-select: none;
box-sizing: border-box;
display: block;
background-color: @component-background;
border-radius: 4px;
border: 1px solid @border-color-base;
transition: all .3s cubic-bezier(.645,.045,.355,1);
&:hover {
border-color: #49a9ee;
}
.@{select-prefix-cls}-focused &,
&:focus,
&:active {
border-color: #49a9ee;
outline: 0;
box-shadow: 0 0 0 2px rgba(16,142,233,.2);
}
&__clear {
.selection__clear();
}
&:hover &__clear {
opacity: 1;
}
&-selected-value {
float: left;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 100%;
padding-right: 14px;
}
}
&-disabled {
color: @disabled-color;
}
&-disabled &-selection {
background: #f7f7f7;
cursor: not-allowed;
&:hover,
&:focus,
&:active {
border-color: @border-color-base;
box-shadow: none;
}
&__clear {
display: none;
visibility: hidden;
pointer-events: none;
}
}
&-disabled &-selection--multiple &-selection__choice {
// background: @background-color-active;
color: #aaa;
padding-right: 10px;
&__remove {
display: none;
}
}
&-selection--single {
height: @input-height-base;
position: relative;
cursor: pointer;
}
&-selection__rendered {
display: block;
margin-left: 7px;
margin-right: 7px;
position: relative;
line-height: @input-height-base - 2px;
// https://github.com/ant-design/ant-design/issues/3481#issuecomment-254721026
&:after {
content: '.';
visibility: hidden;
pointer-events: none;
display: inline-block;
width: 0;
}
}
// &-lg {
// .@{select-prefix-cls}-selection--single {
// height: @input-height-lg;
// }
// .@{select-prefix-cls}-selection__rendered {
// line-height: @input-height-lg - 2px;
// }
// .@{select-prefix-cls}-selection--multiple {
// min-height: @input-height-lg;
// .@{select-prefix-cls}-selection__rendered {
// li {
// height: @input-height-lg - 8px;
// line-height: @input-height-lg - 8px;
// }
// }
// .@{select-prefix-cls}-selection__clear {
// top: @input-height-lg / 2;
// }
// }
// }
// &-sm {
// .@{select-prefix-cls}-selection--single {
// height: @input-height-sm;
// }
// .@{select-prefix-cls}-selection__rendered {
// line-height: @input-height-sm - 2px;
// }
// .@{select-prefix-cls}-selection--multiple {
// min-height: @input-height-sm;
// .@{select-prefix-cls}-selection__rendered {
// li {
// height: @input-height-sm - 8px;
// line-height: @input-height-sm - 8px;
// }
// }
// .@{select-prefix-cls}-selection__clear {
// top: @input-height-sm / 2;
// }
// }
// }
&-disabled &-selection__choice__remove {
color: @disabled-color;
cursor: default;
&:hover {
color: @disabled-color;
}
}
&-search__field__wrap {
display: inline-block;
position: relative;
}
&-selection__placeholder,
&-search__field__placeholder { // for TreeSelect compatibility
position: absolute;
top: 50%;
left: 0;
right: 9px;
color: rgb(151, 168, 190);
line-height: 20px;
height: 20px;
max-width: 100%;
margin-top: -10px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
text-align: left;
}
&-search__field__placeholder {
left: 8px;
}
&-search--inline {
position: absolute;
height: 100%;
width: 100%;
.@{select-prefix-cls}-selection--multiple & {
float: left;
position: static;
}
.@{select-prefix-cls}-search__field__wrap {
width: 100%;
height: 100%;
}
.@{select-prefix-cls}-search__field {
border-width: 0;
font-size: 100%;
height: 100%;
width: 100%;
background: transparent;
outline: 0;
border-radius: @border-radius-base;
}
.@{select-prefix-cls}-search__field__mirror {
position: absolute;
top: 0;
left: -9999px;
white-space: pre;
pointer-events: none;
}
> i {
float: right;
}
}
&-selection--multiple {
min-height: @input-height-base;
cursor: text;
padding-bottom: 3px;
.clearfix;
.@{select-prefix-cls}-search--inline {
width: auto;
padding: 0;
max-width: 100%;
.@{select-prefix-cls}-search__field {
max-width: 100%;
width: 0.75em;
}
}
.@{select-prefix-cls}-selection__rendered {
margin-left: 5px;
margin-bottom: -3px;
height: auto;
}
> ul > li,
.@{select-prefix-cls}-selection__rendered > ul > li { // for tree-select
margin-top: 3px;
height: @input-height-base - 8px;
line-height: @input-height-base - 8px;
}
.@{select-prefix-cls}-selection__choice {
color: @tag-default-color;
background-color: @tag-default-bg;
border-radius: 4px;
cursor: default;
float: left;
margin-right: 4px;
max-width: 99%;
position: relative;
overflow: hidden;
transition: padding .3s @ease-in-out;
padding: 0 20px 0 10px;
&__disabled {
padding: 0 10px;
}
}
.@{select-prefix-cls}-selection__choice__content {
display: inline-block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 100%;
transition: margin .3s @ease-in-out;
}
.@{select-prefix-cls}-selection__choice__remove {
.iconfont-mixin();
// color: @text-color-secondary;
line-height: inherit;
cursor: pointer;
display: inline-block;
font-weight: bold;
transition: all 0.3s @ease-in-out;
// .iconfont-size-under-12px(8px);
position: absolute;
right: 4px;
padding: 0 0 0 8px;
&:hover {
color: #404040;
}
&:before {
content: "\e62e";
}
}
.@{select-prefix-cls}-selection__clear {
top: @input-height-base / 2;
}
}
&-allow-clear &-selection--multiple &-selection__rendered {
margin-right: 20px; // In case that clear button will overlap content
}
&-open {
.@{select-prefix-cls}-arrow {
// .ie-rotate(2);
-ms-transform: rotate(180deg);
&:before {
transform: rotate(180deg);
}
}
.@{select-prefix-cls}-selection {
.active();
}
}
// &-combobox {
// .@{select-prefix-cls}-arrow {
// display: none;
// }
// .@{select-prefix-cls}-search--inline {
// height: 100%;
// width: 100%;
// float: none;
// }
// .@{select-prefix-cls}-search__field__wrap {
// width: 100%;
// height: 100%;
// }
// .@{select-prefix-cls}-search__field {
// width: 100%;
// height: 100%;
// position: relative;
// z-index: 1;
// transition: all .3s @ease-in-out;
// box-shadow: none;
// }
// }
// &-combobox&-allow-clear &-selection:hover &-selection__rendered {
// margin-right: 20px; // In case that clear button will overlap content
// }
}
.@{select-prefix-cls}-dropdown {
// &.slide-up-enter.slide-up-enter-active&-placement-bottomLeft,
// &.slide-up-appear.slide-up-appear-active&-placement-bottomLeft {
// animation-name: antSlideUpIn;
// }
// &.slide-up-enter.slide-up-enter-active&-placement-topLeft,
// &.slide-up-appear.slide-up-appear-active&-placement-topLeft {
// animation-name: antSlideDownIn;
// }
// &.slide-up-leave.slide-up-leave-active&-placement-bottomLeft {
// animation-name: antSlideUpOut;
// }
// &.slide-up-leave.slide-up-leave-active&-placement-topLeft {
// animation-name: antSlideDownOut;
// }
&-hidden {
display: none;
}
background-color: @component-background;
box-shadow: 0 1px 6px rgba(0,0,0,.2);
border-radius: @border-radius-base;
box-sizing: border-box;
// z-index: @zindex-dropdown;
// left: -9999px;
// top: -9999px;
// position: absolute;
outline: none;
overflow: hidden;
font-size: 14px;
// &-menu {
// outline: none;
// margin-bottom: 0;
// padding-left: 0; // Override default ul/ol
// list-style: none;
// max-height: 250px;
// overflow: auto;
// &-item-group-list {
// margin: 0;
// padding: 0;
// > .@{select-prefix-cls}-dropdown-menu-item {
// padding-left: 16px;
// }
// }
// &-item-group-title {
// color: @text-color-secondary;
// line-height: 1.5;
// padding: 8px;
// }
// &-item {
// position: relative;
// display: block;
// padding: 7px 8px;
// font-weight: normal;
// color: @text-color;
// white-space: nowrap;
// cursor: pointer;
// overflow: hidden;
// transition: background 0.3s ease;
// &:hover {
// background-color: @item-hover-bg;
// }
// &-disabled {
// color: @disabled-color;
// cursor: not-allowed;
// &:hover {
// color: @disabled-color;
// background-color: @component-background;
// cursor: not-allowed;
// }
// }
// &-selected {
// &,
// &:hover {
// background-color: @background-color-base;
// font-weight: 600;
// color: @text-color;
// }
// }
// &-active {
// background-color: @item-active-bg;
// }
// &-divider {
// height: 1px;
// margin: 1px 0;
// overflow: hidden;
// background-color: #e5e5e5;
// line-height: 0;
// }
// }
// }
// &&--multiple {
// .@{select-prefix-cls}-dropdown-menu-item {
// &:after {
// .iconfont-font("\e632");
// color: transparent;
// .iconfont-size-under-12px(10px);
// transition: all 0.2s ease;
// position: absolute;
// top: 50%;
// transform: translateY(-50%);
// right: 8px;
// font-weight: bold;
// text-shadow: 0 0.1px 0, 0.1px 0 0, 0 -0.1px 0, -0.1px 0;
// }
// &:hover:after {
// color: #ddd;
// }
// &-disabled:after {
// display: none;
// }
// &-selected:after,
// &-selected:hover:after {
// color: @primary-color;
// display: inline-block;
// }
// }
// }
// &-container-open,
// &-open {
// .@{select-prefix-cls}-dropdown {
// display: block;
// }
// }
}
// .@{select-tree-prefix-cls} {
// margin: 0;
// padding: 0 4px;
// margin-top: -4px;
// font-size: @font-size-base;
// li {
// padding: 0;
// margin: 8px 0;
// list-style: none;
// white-space: nowrap;
// outline: 0;
// &.filter-node {
// > span {
// font-weight: 500;
// }
// }
// ul {
// margin: 0;
// padding: 0 0 0 18px;
// }
// .@{select-tree-prefix-cls}-node-content-wrapper {
// display: inline-block;
// padding: 3px 5px;
// border-radius: 2px;
// margin: 0;
// cursor: pointer;
// text-decoration: none;
// color: @text-color;
// transition: all .3s;
// width: ~"calc(100% - 24px)";
// &:hover {
// background-color: @item-hover-bg;
// }
// &.@{select-tree-prefix-cls}-node-selected {
// background-color: @primary-2;
// }
// }
// span {
// &.@{select-tree-prefix-cls}-checkbox {
// margin: 0 4px 0 0;
// + .@{select-tree-prefix-cls}-node-content-wrapper {
// width: ~"calc(100% - 46px)";
// }
// }
// &.@{select-tree-prefix-cls}-switcher,
// &.@{select-tree-prefix-cls}-iconEle {
// margin: 0;
// width: 24px;
// height: 24px;
// line-height: 22px;
// display: inline-block;
// vertical-align: middle;
// border: 0 none;
// cursor: pointer;
// outline: none;
// text-align: center;
// }
// &.@{select-tree-prefix-cls}-icon_loading {
// &:after {
// display: inline-block;
// .iconfont-font("\e6ae");
// animation: loadingCircle 1s infinite linear;
// color: @primary-color;
// }
// }
// &.@{select-tree-prefix-cls}-switcher {
// &.@{select-tree-prefix-cls}-switcher-noop {
// cursor: auto;
// }
// &.@{select-tree-prefix-cls}-switcher_open {
// .antTreeSwitcherIcon();
// }
// &.@{select-tree-prefix-cls}-switcher_close {
// .antTreeSwitcherIcon();
// .ie-rotate(3);
// &:after {
// transform: rotate(270deg) scale(0.59);
// }
// }
// }
// }
// }
// &-child-tree {
// display: none;
// &-open {
// display: block;
// }
// }
// li&-treenode-disabled {
// > span,
// > .@{select-tree-prefix-cls}-node-content-wrapper,
// > .@{select-tree-prefix-cls}-node-content-wrapper span,
// > span.@{select-tree-prefix-cls}-switcher {
// color: @disabled-color;
// cursor: not-allowed;
// }
// > .@{select-tree-prefix-cls}-node-content-wrapper:hover {
// background: transparent;
// }
// }
// &-icon__open {
// margin-right: 2px;
// vertical-align: top;
// }
// &-icon__close {
// margin-right: 2px;
// vertical-align: top;
// }
// }
.@{select-prefix-cls}-dropdown {
.@{select-prefix-cls}-dropdown-search {
display: block;
padding: 4px;
.@{select-prefix-cls}-search__field__wrap {
width: 100%;
}
.@{select-prefix-cls}-search__field {
padding: 4px 7px;
width: 100%;
box-sizing: border-box;
border: 1px solid @border-color-base;
border-radius: 4px;
outline: none;
height: 28px;
}
&.@{select-prefix-cls}-search--hide {
display: none;
}
}
.@{select-prefix-cls}-not-found {
cursor: not-allowed;
color: @disabled-color;
padding: 7px 16px;
display: block;
}
}