fix: 移动端表单项错误提示、description 样式调整

This commit is contained in:
zhangxulong 2023-06-13 17:13:29 +08:00
parent 6d25b11b21
commit 321c188758
6 changed files with 103 additions and 48 deletions

View File

@ -1110,7 +1110,7 @@ export class FormItemWrap extends React.Component<FormItemProps> {
static: isStatic, static: isStatic,
staticClassName staticClassName
} = props; } = props;
const mobileUI = useMobileUI && isMobile();
description = description || desc; description = description || desc;
return ( return (
@ -1157,6 +1157,8 @@ export class FormItemWrap extends React.Component<FormItemProps> {
</label> </label>
) : null} ) : null}
{mobileUI ? (
<div style={{flex: 1}}>
{renderControl()} {renderControl()}
{caption {caption
@ -1202,6 +1204,55 @@ export class FormItemWrap extends React.Component<FormItemProps> {
}) })
: null} : null}
</div> </div>
) : (
<>
{renderControl()}
{caption
? render('caption', caption, {
className: cx(`Form-caption`, captionClassName)
})
: null}
{remark
? render('remark', {
type: 'remark',
icon: remark.icon || 'warning-mark',
className: cx(`Form-remark`),
tooltip: remark,
useMobileUI,
container:
env && env.getModalContainer
? env.getModalContainer
: undefined
})
: null}
{hint && model && model.isFocused
? render('hint', hint, {
className: cx(`Form-hint`)
})
: null}
{model &&
!model.valid &&
showErrorMsg !== false &&
Array.isArray(model.errors) ? (
<ul className={cx(`Form-feedback`)}>
{model.errors.map((msg: string, key: number) => (
<li key={key}>{msg}</li>
))}
</ul>
) : null}
{renderDescription !== false && description
? render('description', description, {
className: cx(`Form-description`, descriptionClassName)
})
: null}
</>
)}
</div>
); );
}, },

View File

@ -1695,7 +1695,7 @@
--InputRange-handle-onFocus-borderRadius: var( --InputRange-handle-onFocus-borderRadius: var(
--InputRange-handle-border-radius --InputRange-handle-border-radius
); );
--InputRange-padding: #{px2rem(20px)}; --InputRange-padding: #{px2rem(16px)};
--InputRange-handle-icon-width: var(--sizes-size-5); --InputRange-handle-icon-width: var(--sizes-size-5);
--InputRange-handle-icon-height: var(--sizes-size-5); --InputRange-handle-icon-height: var(--sizes-size-5);
--InputRange-handle-icon-color: var(--colors-brand-9); --InputRange-handle-icon-color: var(--colors-brand-9);

View File

@ -243,6 +243,7 @@ $Table-strip-bg: transparent;
--ColorPicker-fontSize: var(--Form-input-fontSize); --ColorPicker-fontSize: var(--Form-input-fontSize);
--ColorPicker-height: var(--Form-input-height); --ColorPicker-height: var(--Form-input-height);
--ColorPicker-lineHeight: var(--Form-input-lineHeight); --ColorPicker-lineHeight: var(--Form-input-lineHeight);
--ColorPicker-height: var(--sizes-base-16);
--ColorPicker-onDisabled-bg: var(--colors-neutral-fill-8); --ColorPicker-onDisabled-bg: var(--colors-neutral-fill-8);
--ColorPicker-onDisabled-color: var(--text--muted-color); --ColorPicker-onDisabled-color: var(--text--muted-color);
--ColorPicker-onFocused-borderColor: var(--Form-input-onFocused-borderColor); --ColorPicker-onFocused-borderColor: var(--Form-input-onFocused-borderColor);

View File

@ -9,6 +9,7 @@
background: var(--ColorPicker-bg); background: var(--ColorPicker-bg);
color: var(--ColorPicker-color); color: var(--ColorPicker-color);
border-radius: var(--borderRadius); border-radius: var(--borderRadius);
height: var(--ColorPicker-height);
&:not(.is-disabled) { &:not(.is-disabled) {
cursor: pointer; cursor: pointer;

View File

@ -627,8 +627,6 @@
font-size: var(--fontSizeLg); font-size: var(--fontSizeLg);
.#{$ns}ColorPicker { .#{$ns}ColorPicker {
height: 100%;
> input { > input {
height: 100%; height: 100%;
} }
@ -663,8 +661,14 @@
padding-bottom: 0; padding-bottom: 0;
} }
.#{$ns}CheckboxControl { .#{$ns}SwitchControl,
padding-top: px2rem(2px); .#{$ns}TransferControl,
.#{$ns}TagControl,
.#{$ns}CheckboxControl,
.#{$ns}TreeSelectControl,
.#{$ns}NestedSelectControl,
.#{$ns}TabsTransferControl {
padding-top: px2rem(3px);
} }
.#{$ns}Form-static { .#{$ns}Form-static {

View File

@ -1,12 +1,12 @@
.#{$ns}InputRange { .#{$ns}InputRange {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: var(--InputRange-padding) 0;
width: 100%; width: 100%;
&-wrap { &-wrap {
position: relative; position: relative;
flex: auto; flex: auto;
padding: var(--InputRange-padding) 0;
} }
&-input { &-input {
@ -34,8 +34,6 @@
} }
&.is-mobile { &.is-mobile {
padding: 0;
.#{$ns}InputRange-input { .#{$ns}InputRange-input {
width: var(--InputRange-input-mobile-width); width: var(--InputRange-input-mobile-width);
// margin-left: 0; // margin-left: 0;