amis/scss/components/form/_form.scss

267 lines
5.3 KiB
SCSS
Raw Normal View History

2019-04-30 11:11:25 +08:00
.#{$ns}Form {
2019-11-26 19:04:47 +08:00
font-size: $Form-fontSize;
position: relative;
&--quickEdit .#{$ns}Form-item:last-child {
margin-bottom: 0;
}
&--inline {
2019-12-06 15:22:17 +08:00
> .#{$ns}PlainField {
2019-11-26 19:04:47 +08:00
display: inline-block;
padding-top: $Form-input-paddingY;
// padding-bottom: $Form-input-paddingY;
2019-04-30 11:11:25 +08:00
}
2019-11-26 19:04:47 +08:00
}
2019-04-30 11:11:25 +08:00
}
.#{$ns}Form-label {
2019-11-26 19:04:47 +08:00
font-weight: $fontWeightNormal;
margin-bottom: px2rem(5px);
display: inline-block;
max-width: 100%;
position: relative;
2019-12-06 15:22:17 +08:00
> span {
2019-11-26 19:04:47 +08:00
position: relative;
}
2019-04-30 11:11:25 +08:00
}
.#{$ns}Form-star {
2019-11-26 19:04:47 +08:00
color: $red;
font-size: $fontSizeXs;
position: absolute;
left: px2rem(-6px);
top: px2rem(3px);
line-height: 1;
2019-04-30 11:11:25 +08:00
}
.#{$ns}Form-feedback {
2019-11-26 19:04:47 +08:00
color: $danger;
margin: $Form-input-marginBottom 0 0;
padding-left: $gap-base;
font-size: $fontSizeSm;
2019-04-30 11:11:25 +08:00
}
.#{$ns}Form-description {
2019-11-26 19:04:47 +08:00
display: block;
color: $Form-description-color;
margin: $Form-input-marginBottom 0 0;
font-size: $Form-description-fontSize;
2019-04-30 11:11:25 +08:00
}
.#{$ns}Form-hint {
2019-11-26 19:04:47 +08:00
display: inline-block;
margin-left: $gap-sm;
padding-top: $Form-input-paddingY;
vertical-align: top;
2019-04-30 11:11:25 +08:00
}
.#{$ns}Form-item {
2019-11-26 19:04:47 +08:00
margin-bottom: $Form-item-gap;
2019-04-30 11:11:25 +08:00
2019-12-06 15:22:17 +08:00
.#{$ns}Grid-form > &:last-child {
2019-11-26 19:04:47 +08:00
margin-bottom: 0;
}
2019-04-30 11:11:25 +08:00
2019-12-06 15:22:17 +08:00
.#{$ns}Form--inline > &--inline {
2019-11-26 19:04:47 +08:00
margin-bottom: $Form-item-gap/2;
margin-right: $Form-item-gap/2;
2019-04-30 11:11:25 +08:00
2019-11-26 19:04:47 +08:00
&:last-child {
margin-right: 0;
margin-bottom: 0;
2019-04-30 11:11:25 +08:00
}
2019-11-26 19:04:47 +08:00
}
2019-04-30 11:11:25 +08:00
2019-11-26 19:04:47 +08:00
.#{$ns}Form-remark {
margin-top: ($Form-input-height - $fontSizeBase) / 2;
vertical-align: top;
}
2019-04-30 11:11:25 +08:00
2019-11-26 19:04:47 +08:00
&--horizontal {
2019-12-06 15:22:17 +08:00
> .#{$ns}Form-label {
2019-11-26 19:04:47 +08:00
text-align: $Form--horizontal-label-align;
white-space: $Form--horizontal-label-whiteSpace;
2019-04-30 11:11:25 +08:00
}
2019-11-26 19:04:47 +08:00
}
2019-04-30 11:11:25 +08:00
2019-11-26 19:04:47 +08:00
&--normal {
2019-12-06 15:22:17 +08:00
> .#{$ns}Form-label {
2019-11-26 19:04:47 +08:00
display: block;
2019-04-30 11:11:25 +08:00
}
2019-11-26 19:04:47 +08:00
}
2019-04-30 11:11:25 +08:00
2019-12-06 15:22:17 +08:00
&.is-error > .#{$ns}Form-label {
2019-11-26 19:04:47 +08:00
color: $danger;
}
2019-04-30 11:11:25 +08:00
}
.#{$ns}Form-placeholder {
2019-11-26 19:04:47 +08:00
color: $Form-input-placeholderColor;
2019-04-30 11:11:25 +08:00
}
@include media-breakpoint-up(sm) {
2019-11-26 19:04:47 +08:00
.#{$ns}Form-control--sizeXs {
min-width: $Form-control-widthXs;
width: auto;
display: inline-block;
vertical-align: top;
}
2019-11-26 19:04:47 +08:00
.#{$ns}Form-control--sizeSm {
min-width: $Form-control-widthSm;
width: auto;
display: inline-block;
vertical-align: top;
}
2019-11-26 19:04:47 +08:00
.#{$ns}Form-control--sizeMd {
min-width: $Form-control-widthMd;
width: auto;
display: inline-block;
vertical-align: top;
}
2019-04-30 11:11:25 +08:00
2019-11-26 19:04:47 +08:00
.#{$ns}Form-control--sizeLg {
min-width: $Form-control-widthLg;
width: auto;
display: inline-block;
vertical-align: top;
}
2019-04-30 11:11:25 +08:00
2019-11-26 19:04:47 +08:00
.#{$ns}Form-item {
&--horizontal {
display: flex;
flex-wrap: nowrap;
margin-left: -$Form--horizontal-gutterWidth / 2;
margin-right: -$Form--horizontal-gutterWidth / 2;
2019-12-06 15:22:17 +08:00
> * {
2019-11-26 19:04:47 +08:00
padding-left: $Form--horizontal-gutterWidth / 2;
padding-right: $Form--horizontal-gutterWidth / 2;
}
2019-12-06 15:22:17 +08:00
> .#{$ns}Form-label,
> .#{$ns}Form-value {
2019-11-26 19:04:47 +08:00
flex-basis: 0;
flex-grow: 1;
max-width: 100%;
width: 0;
}
.#{$ns}Form-itemColumn--xs,
.#{$ns}Form-itemColumn--sm,
.#{$ns}Form-itemColumn--normal,
.#{$ns}Form-itemColumn--md,
.#{$ns}Form-itemColumn--lg {
flex-grow: unset;
flex-basis: unset;
}
2019-12-06 15:22:17 +08:00
> .#{$ns}Form-label {
2019-11-26 19:04:47 +08:00
padding-top: $Form-label-paddingTop;
margin-bottom: 0;
}
2019-04-30 11:11:25 +08:00
2019-11-26 19:04:47 +08:00
.#{$ns}Form-itemColumn--xs {
width: $Form--horizontal-label-widthXs;
}
2019-04-30 11:11:25 +08:00
2019-11-26 19:04:47 +08:00
.#{$ns}Form-itemColumn--sm {
width: $Form--horizontal-label-widthSm;
}
2019-04-30 11:11:25 +08:00
2019-11-26 19:04:47 +08:00
.#{$ns}Form-itemColumn--normal {
width: $Form--horizontal-label-widthBase;
}
2019-04-30 11:11:25 +08:00
2019-11-26 19:04:47 +08:00
.#{$ns}Form-itemColumn--md {
width: $Form--horizontal-label-widthMd;
}
2019-04-30 11:11:25 +08:00
2019-11-26 19:04:47 +08:00
.#{$ns}Form-itemColumn--lg {
width: $Form--horizontal-label-widthLg;
}
2019-04-30 11:11:25 +08:00
2019-11-26 19:04:47 +08:00
@for $i from (1) through $Form--horizontal-columns {
.#{$ns}Form-itemColumn--#{$i} {
flex: 0 0 percentage($i / $Form--horizontal-columns);
max-width: percentage($i / $Form--horizontal-columns);
min-height: 1px;
2019-04-30 11:11:25 +08:00
}
2019-11-26 19:04:47 +08:00
}
2019-04-30 11:11:25 +08:00
}
2019-11-26 19:04:47 +08:00
&--inline {
display: inline-block;
vertical-align: top;
2019-04-30 11:11:25 +08:00
2019-12-06 15:22:17 +08:00
> .#{$ns}Form-label {
2019-11-26 19:04:47 +08:00
padding-top: $Form-label-paddingTop;
margin-bottom: 0;
margin-right: $Form-item-gap/2;
2019-04-30 11:11:25 +08:00
2019-11-26 19:04:47 +08:00
.#{$ns}Form-star {
position: static;
2019-04-30 11:11:25 +08:00
}
2019-11-26 19:04:47 +08:00
}
2019-04-30 11:11:25 +08:00
2019-12-06 15:22:17 +08:00
> .#{$ns}Form-value {
2019-11-26 19:04:47 +08:00
display: inline;
2019-04-30 11:11:25 +08:00
2019-12-06 15:22:17 +08:00
> .#{$ns}Form-control {
2019-11-26 19:04:47 +08:00
vertical-align: top;
display: inline-block;
}
2019-04-30 11:11:25 +08:00
2019-12-06 15:22:17 +08:00
> .#{$ns}Form-control.#{$ns}InputGroup {
2019-11-26 19:04:47 +08:00
display: inline-flex;
2019-04-30 11:11:25 +08:00
}
2019-12-06 15:22:17 +08:00
> .#{$ns}TextControl--withAddOn {
2019-11-26 19:04:47 +08:00
display: inline-flex;
2019-12-06 15:22:17 +08:00
min-width: $Form-control-widthMd;
2019-04-30 11:11:25 +08:00
}
2019-11-26 19:04:47 +08:00
}
}
}
.#{$ns}Form-row {
display: flex;
flex-wrap: wrap;
margin-left: -$Form-row-gutterWidth / 2;
margin-right: -$Form-row-gutterWidth / 2;
align-items: flex-start;
2019-12-06 15:22:17 +08:00
> * {
2019-11-26 19:04:47 +08:00
padding-left: $Form-row-gutterWidth / 2;
padding-right: $Form-row-gutterWidth / 2;
}
}
.#{$ns}Form-col {
flex-basis: 0;
flex-grow: 1;
flex-shrink: 1;
}
.#{$ns}Form-rowInner {
display: flex;
flex-wrap: nowrap;
2019-12-06 15:22:17 +08:00
> .#{$ns}Form-label {
2019-11-26 19:04:47 +08:00
display: inline-block;
vertical-align: top;
padding-top: $Form-label-paddingTop;
padding-right: $Form-row-gutterWidth;
2019-04-30 11:11:25 +08:00
}
2019-11-26 19:04:47 +08:00
2019-12-06 15:22:17 +08:00
> .#{$ns}Form-control {
2019-11-26 19:04:47 +08:00
flex-basis: 0;
flex-grow: 1;
}
}
2019-12-06 15:22:17 +08:00
}