zui
Version:
一个基于 Bootstrap 深度定制开源前端实践方案,帮助你快速构建现代跨屏应用。
295 lines (270 loc) • 6.49 kB
text/less
.picker {
background-color: #eeeeee;
min-height: @input-height-base;
&:not(.picker-ready) > * {
display: none;
}
}
.picker-selections {
min-height: @input-height-base;
color: @input-color;
background-color: @input-bg;
border: 1px solid @input-border;
border-radius: @input-border-radius;
box-shadow: @input-shadow;
position: relative;
.picker-focus & {
@color-rgba: rgba(red(@input-border-focus), green(@input-border-focus), blue(@input-border-focus), .6);
border-color: @input-border-focus;
box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px @color-rgba;
}
.picker-multi & {
padding: 3px;
}
.picker-multi.picker-focus &:before {
position: absolute;
display: block;
width: 24px;
height: 14px;
text-align: center;
opacity: .4;
bottom: 8px;
right: 0;
content: @icon-search;
.icon-zenicon();
}
.picker-multi.picker-focus.picker-loading &::before {
content: @icon-spinner-indicator;
display: inline-block;
animation: spin 2s infinite linear;
}
}
.picker-selection {
.picker-multi & {
display: inline-block;
position: relative;
padding: 0 20px 0 5px;
line-height: 18px;
margin: 2px;
background-color: @color-gray-pale;
border-radius: @border-radius-small;
border: 1px solid @color-gray-light;
background-clip: padding-box;
box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0,0,0,.05);
}
}
.picker-selection-single {
padding: @padding-base-vertical 20px @padding-base-vertical @padding-small-horizontal;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
max-width: 100%;
.picker-focus & .picker-selection-text {
display: none;
}
&:after {
position: absolute;
display: block;
width: 24px;
height: 14px;
text-align: center;
opacity: .4;
top: 7px;
right: 0;
content: @icon-caret-down;
.icon-zenicon();
}
.picker-focus &::after {
content: @icon-search;
}
.picker-focus.picker-loading &::after {
content: @icon-spinner-indicator;
display: inline-block;
animation: spin 2s infinite linear;
}
}
.picker-selection-remove {
position: absolute;
width: 20px;
height: 20px;
text-align: center;
opacity: .2;
top: 0;
right: 0;
cursor: pointer;
&:before {
content: @icon-remove;
.icon-zenicon();
text-shadow: @close-text-shadow;
}
&:hover {
opacity: .5;
}
.picker-single & {
top: 5px;
right: 20px;
z-index: 1;
}
.picker-no-value &,
.picker-single.picker-focus & {
display: none;
}
}
.picker-selection-text {
.picker-multi.picker-sortable & {
cursor: move;
}
}
.picker-search {
border: none;
background: none;
color: transparent;
&:focus {
outline: none;
color: inherit;
}
.picker-single & {
width: 100%;
position: absolute;
padding: @padding-base-vertical @padding-small-horizontal;
left: 0;
right: 0;
bottom: 0;
top: 0;
z-index: 1;
}
.picker-multi & {
display: inline-block;
width: 10px;
padding: 0 2px;
margin: 2px 0;
min-width: 10px;
max-width: 100%;
}
}
.picker-placeholder {
color: @input-color-placeholder;
position: absolute;
top: 5px;
left: 8px;
right: 20px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
display: none;
z-index: 0;
.picker-no-value.picker-focus & {
display: none;
}
.picker-input-empty.picker-focus.picker-no-value &,
.picker-no-value & {
display: block;
}
}
.picker-drop-menu {
display: none;
position: fixed;
z-index: 1200;
background-color: #fff;
border-radius: @border-radius-base;
box-shadow: 0 6px 12px rgba(0,0,0,.12), 0 1px 3px rgba(0,0,0,.1);
border: 1px solid @dropdown-border;
min-width: 100px;
opacity: 0;
// transition: opacity .1s linear;
&.picker-drop-show {
display: block;
}
&.picker-has-message {
min-height: 22px;
padding-bottom: 22px;
}
}
.picker-option-list {
margin: 0;
padding: 5px 0;
overflow-y: auto;
.picker-no-options & {
display: none;
}
.picker-has-message & {
}
}
.picker-option {
display: block;
padding: 5px 10px;
clear: both;
font-weight: normal;
line-height: @line-height-base;
min-height: 30px;
color: @dropdown-link-color;
white-space: nowrap; // prevent links from randomly breaking onto new lines
overflow: hidden;
text-overflow: ellipsis;
transition: none;
.picker-single &.picker-option-selected {
background: @color-pale;
color: @color-primary;
}
&:hover,
&:focus {
text-decoration: none;
}
.picker-single &.picker-option-selected.picker-option-active,
&.picker-option-active {
color: @dropdown-link-hover-color;
background-color: @dropdown-link-hover-bg;
}
.picker-multi &.picker-option-selected {
&,
&.picker-option-active {
color: #ccc;
cursor: not-allowed;
background-color: #fff;
}
}
}
.picker-option-text-matched {
position: relative;
color: @color-primary;
&:before {
content: ' ';
display: block;
position: absolute;
bottom: -4px;
left: 0;
right: 0;
height: 2px;
border-radius: 2px;
opacity: .5;
background-color: @color-primary;
}
.picker-option-active &,
.picker-option:hover & {
color: #fff;
&:before {
background-color: #fff;
}
}
}
.picker-message {
font-size: 12px;
color: @color-gray;
padding: 2px 5px;
background-color: @color-gray-pale;
position: absolute;
height: 22px;
bottom: 0;
left: 0;
right: 0;
display: none;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
.picker-has-message & {
display: block;
}
&[data-type="danger"] {
color: @color-danger;
}
}