Files
vxe-table/styles/button.scss
2020-03-30 19:05:46 +08:00

278 lines
6.6 KiB
SCSS

/**Variable**/
@import './helpers/mixin.scss';
$btnThemeList: (
(
name: "primary",
textColor: $vxe-primary-color,
btnColor: #fff,
btnBackground: $vxe-primary-color
),
(
name: "success",
textColor: $vxe-success-color,
btnColor: #fff,
btnBackground: $vxe-success-color
),
(
name: "info",
textColor: $vxe-info-color,
btnColor: #fff,
btnBackground: $vxe-info-color
),
(
name: "warning",
textColor: $vxe-warning-color,
btnColor: #fff,
btnBackground: $vxe-warning-color
),
(
name: "danger",
textColor: $vxe-danger-color,
btnColor: #fff,
btnBackground: $vxe-danger-color
),
(
name: "perfect",
textColor: $vxe-table-header-background-color,
btnColor: $vxe-font-color,
btnBackground: $vxe-table-header-background-color
)
);
.vxe-button {
position: relative;
text-align: center;
background-color: $vxe-button-default-background-color;
outline: 0;
font-size: $vxe-font-size;
white-space: nowrap;
user-select: none;
@include animatTransition(border, .2s);
&.is--disabled {
color: $vxe-disabled-color;
&:not(.is--loading) {
cursor: no-drop;
}
}
&:not(.is--disabled) {
color: $vxe-font-color;
cursor: pointer;
}
&.is--loading {
&:before {
content: "";
position: absolute;
left: -1px;
top: -1px;
right: -1px;
bottom: -1px;
border-radius: inherit;
background-color: hsla(0,0%,100%,.35);
pointer-events: none;
}
}
&.type--text {
text-decoration: none;
border: 0;
background-color: transparent;
&:not(.is--disabled) {
&:hover {
color: lighten($vxe-primary-color, 10%);
}
}
@for $index from 0 to length($btnThemeList) {
$item: nth($btnThemeList, $index + 1);
$textColor: map-get($item, textColor);
&.theme--#{map-get($item, name)} {
color: $textColor;
&:not(.is--disabled) {
&:hover {
color: lighten($textColor, 10%);
}
}
&.is--disabled {
color: lighten($textColor, 20%);
}
}
}
}
&.type--button {
padding: 0 1em;
height: $vxe-button-height-default;
line-height: $vxe-button-height-default - 2px;
border: 1px solid $vxe-input-border-color;
border-radius: 0.2em;
&:not(.is--disabled) {
&:hover {
color: lighten($vxe-primary-color, 6%);
}
&:focus {
border-color: $vxe-primary-color;
box-shadow: 0 0 0.2em 0 $vxe-primary-color;
}
&:active {
color: darken($vxe-primary-color, 3%);
border-color: darken($vxe-primary-color, 3%);
background-color: darken($vxe-button-default-background-color, 3%);
}
}
@for $index from 0 to length($btnThemeList) {
$item: nth($btnThemeList, $index + 1);
$btnColor: map-get($item, btnColor);
$btnBackground: map-get($item, btnBackground);
&.theme--#{map-get($item, name)} {
color: $btnColor;
&:not(.is--disabled) {
border-color: $btnBackground;
background-color: $btnBackground;
&:hover {
color: $btnColor;
background-color: lighten($btnBackground, 6%);
border-color: lighten($btnBackground, 6%);
}
&:active {
color: $btnColor;
background-color: darken($btnBackground, 3%);
border-color: darken($btnBackground, 3%);
}
}
&.is--disabled {
border-color: lighten($btnBackground, 20%);
background-color: lighten($btnBackground, 20%);
}
&.is--loading {
border-color: $btnBackground;
background-color: $btnBackground;
}
}
}
}
&.size--medium {
font-size: $vxe-font-size-medium;
&.type--button {
height: $vxe-button-height-medium;
line-height: $vxe-button-height-medium - 2px;
}
}
&.size--small {
font-size: $vxe-font-size-small;
&.type--button {
height: $vxe-button-height-small;
line-height: $vxe-button-height-small - 2px;
}
}
&.size--mini {
font-size: $vxe-font-size-mini;
&.type--button {
height: $vxe-button-height-mini;
line-height: $vxe-button-height-mini - 2px;
}
}
}
.vxe-input,
.vxe-button {
&+.vxe-button,
&+.vxe-button--dropdown {
margin-left: 0.8em;
}
}
.vxe-button--loading-icon,
.vxe-button--icon {
&+.vxe-button--content {
margin-left: 0.3em;
}
}
.vxe-button--wrapper,
.vxe-button--dropdown {
display: inline-block;
}
.vxe-button--dropdown {
position: relative;
&+.vxe-button,
&+.vxe-button--dropdown {
margin-left: 0.8em;
}
& > .vxe-button {
&.type--button {
@for $index from 0 to length($btnThemeList) {
$item: nth($btnThemeList, $index + 1);
$btnColor: map-get($item, btnColor);
&.theme--#{map-get($item, name)} {
color: $btnColor;
}
}
}
}
&.is--active {
& > .vxe-button {
&:not(.is--disabled) {
color: lighten($vxe-primary-color, 6%);
}
&.type--text {
@for $index from 0 to length($btnThemeList) {
$item: nth($btnThemeList, $index + 1);
$textColor: map-get($item, textColor);
&.theme--#{map-get($item, name)} {
color: lighten($textColor, 10%);
}
}
}
&.type--button {
@for $index from 0 to length($btnThemeList) {
$item: nth($btnThemeList, $index + 1);
$btnColor: map-get($item, btnColor);
$btnBackground: map-get($item, btnBackground);
&.theme--#{map-get($item, name)} {
color: $btnColor;
background-color: lighten($btnBackground, 6%);
border-color: lighten($btnBackground, 6%);
}
}
}
}
.vxe-button--dropdown-arrow {
transform: rotate(180deg);
}
}
}
.vxe-button--dropdown-arrow {
font-size: 12px;
margin: -0.18em 0 0 0.3em;
@include animatTransition(transform, .2s);
}
.vxe-button--dropdown-panel {
display: none;
position: absolute;
left: 0;
padding: 0.2em 0;
&.animat--leave {
display: block;
opacity: 0;
transform: scaleY(0.5);
transition: transform 0.2s, opacity 0.2s;
transform-origin: 0% 0%;
}
&.animat--enter {
opacity: 1;
transform: scaleY(1);
}
}
.vxe-button--dropdown-wrapper {
padding: 5px;
background-color: #fff;
border-radius: 4px;
border: 1px solid $vxe-input-border-color;
box-shadow: 0 1px 6px rgba(0,0,0,.2);
& > .vxe-button {
margin: 0;
display: block;
width: 100%;
border: 0;
&.type--text {
padding: 2px 8px;
}
}
}