From f5d44aabe4c975a3800514f9cc0e44356224fba2 Mon Sep 17 00:00:00 2001 From: liaoxuezhi Date: Mon, 11 Oct 2021 11:24:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=9D=99=E6=80=81=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E4=B9=9F=E6=94=AF=E6=8C=81=20borderMode=20=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=20(#2672)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: 静态展示也支持 borderMode 配置 * 更新 carousel dom 变化后的 snapshot --- .../__snapshots__/Carousel.test.tsx.snap | 30 ++++++++----------- scss/components/form/_form.scss | 13 ++++++++ src/renderers/Form/Static.tsx | 14 +++++++-- 3 files changed, 38 insertions(+), 19 deletions(-) diff --git a/__tests__/renderers/__snapshots__/Carousel.test.tsx.snap b/__tests__/renderers/__snapshots__/Carousel.test.tsx.snap index 27a42f4de..d74d00c00 100644 --- a/__tests__/renderers/__snapshots__/Carousel.test.tsx.snap +++ b/__tests__/renderers/__snapshots__/Carousel.test.tsx.snap @@ -66,24 +66,20 @@ exports[`Renderer:carousel 1`] = ` /> + diff --git a/scss/components/form/_form.scss b/scss/components/form/_form.scss index 98c7919b7..e8a05ccda 100644 --- a/scss/components/form/_form.scss +++ b/scss/components/form/_form.scss @@ -33,6 +33,19 @@ display: inline-block; vertical-align: top; } + + &--borderFull { + border: var(--Form-input-borderWidth) solid var(--Form-input-borderColor); + border-radius: var(--Form-input-borderRadius); + padding: var(--Form-input-paddingY) var(--Form-input-paddingX); + } + + &--borderHalf { + border-bottom: var(--Form-input-borderWidth) solid + var(--Form-input-borderColor); + border-radius: var(--Form-input-borderRadius); + padding: var(--Form-input-paddingY) var(--Form-input-paddingX); + } } .#{$ns}Form-label { diff --git a/src/renderers/Form/Static.tsx b/src/renderers/Form/Static.tsx index 9471c2920..8724ddbdf 100644 --- a/src/renderers/Form/Static.tsx +++ b/src/renderers/Form/Static.tsx @@ -5,7 +5,7 @@ import PopOver, {SchemaPopOver} from '../PopOver'; import QuickEdit, {SchemaQuickEdit} from '../QuickEdit'; import {Renderer} from '../../factory'; import Copyable, {SchemaCopyable} from '../Copyable'; -import {extendObject} from '../../utils/helper'; +import {extendObject, ucFirst} from '../../utils/helper'; import omit = require('lodash/omit'); import {SchemaObject, SchemaTpl, SchemaType} from '../../Schema'; @@ -40,6 +40,11 @@ export interface StaticExactControlSchema extends FormBaseControl { * 配置点击复制功能 */ copyable?: SchemaCopyable; + + /** + * 边框模式,默认是无边框的 + */ + borderMode?: 'full' | 'half' | 'none'; } export interface StaticProps extends FormControlProps { @@ -91,6 +96,7 @@ export default class StaticControl extends React.Component { disabled, $schema, defaultValue, + borderMode, ...rest } = this.props; @@ -106,7 +112,11 @@ export default class StaticControl extends React.Component { }; return ( -
+